<template>
  <div class="work" >
    <el-row>
      <el-col style="margin: 10px 0">
        <span class="page-title">工作台</span>
        <span class="page-user">欢迎您 中科韬睿 {{emp.empName}} {{emp.job.jobName}}</span>
      </el-col>
    </el-row>
    <el-row class="b-g-w m-b-10">
      <el-col :span="19">
        <el-row class="p-20">
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2">
            <div class="table-detail text-center" >
              <router-link :to="'customer'" class="btn">
                <div class="iconbox">
                  <i class="fa a-file-text el-icon-user-solid"></i>
                </div>
                <p class="font-14-b">客户</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2">
            <div class="table-detail text-center">
              <router-link :to="'task'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="fa a-file-text el-icon-s-cooperation"></i>
                </div>
                <p class="font-14-b">待办任务</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2">
            <div class="table-detail text-center">
              <router-link :to="'opportunity'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="el-icon-s-flag"></i>
                </div>
                <p class="font-14-b">销售机会</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2">
            <div class="table-detail text-center">
              <router-link :to="'contract'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="fa a-file-text el-icon-document"></i>
                </div>
                <p class="font-14-b">合同订单</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2 || this.emp.department.deptId === 4">
            <div class="table-detail text-center">
              <router-link :to="'receivablerecords'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="fa a-file-text el-icon-coin"></i>
                </div>
                <p class="font-14-b">回款</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 3">
            <div class="table-detail text-center">
              <router-link :to="'opportunity'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="el-icon-s-goods"></i>
                </div>
                <p class="font-14-b">采购</p>
              </router-link>
            </div>
          </el-col>
          <el-col :span="3" v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 3">
            <div class="table-detail text-center">
              <router-link :to="'product'" class="btn">
                <div class="iconbox bg-primary m-lg">
                  <i class="fa a-file-text el-icon-bangzhu"></i>
                </div>
                <p class="font-14-b">产品</p>
              </router-link>
            </div>
          </el-col>
        </el-row>
      </el-col>
      <el-row style="height: 40px;width: 40px"></el-row>
      <el-col :span="5">
        <el-row class="text-right">
          <el-input v-model="content" clearable placeholder="找功能" style="width: 60%"></el-input>
          <el-button @click="findMenu" icon="el-icon-search"  style="padding: 12px 12px;margin: 0 20px 0 0"></el-button>
          <ul id="menu-ul" v-show="menuShow" class="menu-ul" v-if="funMenuList.length !== 0">
            <li id="menu-li" @click="goMenu(item)" v-for="item in funMenuList">
              <a class="cursor" id="menu-a">{{item.functionName}}</a>
            </li>
          </ul>
        </el-row>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <!--消息-->
      <el-col :span="8">
        <el-row class="b-g-w">
          <el-row class="p-20">
            <el-row><p>消息</p></el-row>
            <el-row>
              <div style="height: 430px">
                <h1 v-if="this.approvalList.length === 0" class="ng-scope-show">无消息</h1>
                <el-row @click.native="toAppView(item)" class="inbox-item" :key="index" v-for="(item,index) in approvalList">
                  <el-col :span="8" class="iconboxs">
                    <div class="iconboxs-i">
                      <span v-if="item.approvalClassify == 1"><i class="el-icon-bicycle"/></span>
                      <span v-if="item.approvalClassify == 2"><i class="el-icon-notebook-2"/></span>
                      <span v-if="item.approvalClassify == 3"><i class="el-icon-document-copy"/></span>
                      <span v-if="item.approvalClassify == 4"><i class="el-icon-shopping-cart-1"/></span>
                      <span v-if="item.approvalClassify == 5"><i class="el-icon-coin"/></span>
                    </div>
                  </el-col>
                  <el-col :span="16" class="">
                    <div class="inbox-item-author">
                      <span>业务消息：</span>
                      <span v-if="item.approvalClassify == 1">出差申请审批</span>
                      <span v-if="item.approvalClassify == 2">报价申请审批</span>
                      <span v-if="item.approvalClassify == 3">合同/订单申请审批</span>
                      <span v-if="item.approvalClassify == 4">采购申请审批</span>
                      <span v-if="item.approvalClassify == 5">计划付款申请审批</span>
                    </div>
                    <div class="inbox-item-text">
                      <span v-if="item.approvalClassify == 1">出差申请审批</span>
                      <span v-if="item.approvalClassify == 2">报价申请审批</span>
                      <span v-if="item.approvalClassify == 3">合同/订单申请审批</span>
                      <span v-if="item.approvalClassify == 4">采购申请审批</span>
                      <span v-if="item.approvalClassify == 5">计划付款申请审批</span>
                      <span>{{item.employeeByApplicantEmpId.empName}}：</span>
                      <span>{{item.approvalTheme}}</span>
                    </div>
                  </el-col>
                  <el-col style="color: #a0a0a0" :span="4">
                    {{item.approvalTime | formatDate}}
                  </el-col>
                </el-row>
              </div>
              <div style="text-align: center">
                <el-pagination small layout="prev, pager, next"
                  :total="totalSize" @current-change="changePage"
                  :current-page.sync="currPage" :page-size="pageSize">
                </el-pagination>
              </div>
            </el-row>
          </el-row>
        </el-row>
      </el-col>
      <!--待办任务-->
      <el-col :span="8">
        <el-row class="b-g-w">
          <el-row class="p-20">
            <el-row >
              <div class="pull-right ">
                <p>
                  <span @click="findChatTask" class="pad-mar-5 cursor">最近沟通</span>
                  <span @click="findExpiredTask" class="pad-mar-5 cursor">过期</span>
                </p>
              </div>
              <p>待办任务</p>
            </el-row>
            <el-row>
              <div style="height: 430px">
                <div class="text-center" v-show="isChShow">
                  <span class="label-danger" @click="closeChShow">
                    <span class="ng-binding ng-scope" style="">最近沟通</span>
                    <i class="el-icon-close"></i>
                  </span>
                </div>
                <h1 v-if="this.taskList.length === 0" class="ng-scope-show">无任务</h1>
                <div class="text-center" v-show="isExShow">
                  <span class="label-danger" @click="closeExShow">
                    <span class="ng-binding ng-scope" style="">过期</span>
                    <i class="el-icon-close"></i>
                  </span>
                </div>
                <el-row @click.native="toTaskView(item)" class="inbox-item" :key="index" v-for="(item,index) in taskList">
                  <el-col :span="2" class="iconboxs">
                    <div class="iconboxs-i-s"><img :src="emp.empImg"></div>
                  </el-col>
                  <el-col :span="18" class="">
                    <div class="inbox-item-author">
                      <span>{{item.taskDescribe}}</span>
                    </div>
                    <div class="inbox-item-ng">
                      <span class="iconboxs-i-m"><img :src="item.employeeByExeEmpId.empImg"></span>
                      <span><i class="el-icon-s-home"/></span>
                      <span>{{item.customerByCustomerId.customerName}}</span>
                      <span>{{item.taskContactName}}</span>
                    </div>
                    <div class="inbox-item-text">
                      <span>{{item.employeeByEmpId.empName}}</span>
                      <span>新建待办任务</span>
                    </div>
                  </el-col>
                  <el-col style="color: #a0a0a0" :span="2">
                    {{item.taskFinishDate | formatDate2}}
                  </el-col>
                </el-row>
              </div>
              <div style="text-align: center">
                <el-pagination small layout="prev, pager, next"
                               :total="taskTotalSize" @current-change="changePageTask"
                               :current-page.sync="taskCurrPage" :page-size="taskPageSize">
                </el-pagination>
              </div>
            </el-row>
          </el-row>
        </el-row>
      </el-col>
      <!--提醒-->
      <el-col :span="8">
        <el-row class="b-g-w">
          <el-row class="p-20" style="height: 537px">
            <el-row>
              <p>提醒</p>
              <el-tabs >
                <el-tab-pane v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2"  label="销售">
                  <el-row>
                    <el-col :span="12">
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(1)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-document-copy"></i>
                          </div>
                          <p class="text-muted margin-0">合约交付</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="合约交付" placement="bottom">
                            <div @click="clickDialog(1)" class="cursor">
                              <b class="font-18">{{conTotalSize}}</b>
                              <span class="font-14">条</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(2)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-connection"></i>
                          </div>
                          <p class="text-muted margin-0">计划回款</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="过期和未来30天" placement="bottom">
                            <div @click="clickDialog(2)" class="cursor">
                              <b class="font-18">{{contractPlanPaFtThTotalSize}}</b>
                              <span class="font-14">笔</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div class="table-detail text-center cursor">
                          <div @click="clickDialog(3)" class="iconb-lef">
                            <i class="el-icon-phone-outline"></i>
                          </div>
                          <p class="text-muted margin-0">客户投诉</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="未处理和处理中" placement="bottom">
                            <div @click="clickDialog(3)" class="cursor">
                              <b class="font-18">{{complainTotalSize}}</b>
                              <span class="font-14">条</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(4)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-truck"></i>
                          </div>
                          <p class="text-muted margin-0">未发货</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="待发货" placement="bottom">
                            <div @click="clickDialog(4)" class="cursor">
                              <b class="font-18">0</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(5)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-postcard"></i>
                          </div>
                          <p class="text-muted margin-0">未尽回款</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="不含终止和结束" placement="bottom">
                            <div @click="clickDialog(5)" class="cursor">
                              <b class="font-18">{{conNotPaymentTotalSize}}</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <!--<div class="m-t-20 w-80">
                        <div @click="clickDialog(6)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-potato-strips"></i>
                          </div>
                          <p class="text-muted margin-0">联系人生日</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="本月和下月" placement="bottom">
                            <div @click="clickDialog(6)" class="cursor">
                              <b class="font-18">0</b>
                              <span class="font-14">人</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>-->
                    </el-col>
                  </el-row>
                </el-tab-pane>
                <el-tab-pane v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 5" label="客服">
                  <el-row>
                    <div class="m-l-20">
                      <el-input v-model="qaContent" clearable placeholder="QA（问题和回答）" style="width: 75%"></el-input>
                      <el-button @click="findQa(qaContent)" type="primary" icon="el-icon-search" size="small" circle></el-button>
                    </div>
                    <ul id="qa-ul" v-show="qaShow" class="qa-ul" v-if="qaList.length !== 0">
                      <li id="qa-li" @click="openQa(item)" v-for="item in qaList">
                        <a class="cursor" id="qa-a">{{item.qaQuestion}}</a>
                      </li>
                    </ul>
                  </el-row>
                </el-tab-pane>
                <el-tab-pane v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2 || this.emp.department.deptId === 3 || this.emp.department.deptId === 4"  label="财务">
                  <el-row>
                    <el-col :span="12">
                    <div class="m-t-20 w-80">
                      <div @click="clickDialog(7)" class="table-detail text-center cursor">
                        <div class="iconb-lef">
                          <i class="el-icon-coin"></i>
                        </div>
                        <p class="text-muted margin-0">计划付款</p>
                      </div>
                      <div class="num-s">
                        <el-tooltip class="item" effect="dark" content="过期和未来30天" placement="bottom">
                          <div @click="clickDialog(7)" class="cursor">
                            <b class="font-18">{{paymentPlanPaFtThTotalSize}}</b>
                            <span class="font-14">笔</span>
                          </div>
                        </el-tooltip>
                      </div>
                    </div>
                    <div class="m-t-20 w-80">
                      <div @click="clickDialog(8)" class="table-detail text-center cursor">
                        <div class="iconb-lef">
                          <i class="el-icon-coin"></i>
                        </div>
                        <p class="text-muted margin-0">本月付款</p>
                      </div>
                      <div class="num-s">
                        <el-tooltip class="item" effect="dark" content="本月" placement="bottom">
                          <div @click="clickDialog(8)" class="cursor">
                            <b class="font-18">{{paymentRecordMonthTotalSize}}</b>
                            <span class="font-14">笔</span>
                          </div>
                        </el-tooltip>
                      </div>
                    </div>
                  </el-col>
                    <el-col :span="12">
                    <div class="m-t-20 w-80">
                      <div @click="clickDialog(2)"  class="table-detail text-center cursor">
                        <div class="iconb-lef">
                          <i class="el-icon-connection"></i>
                        </div>
                        <p class="text-muted margin-0">计划回款</p>
                      </div>
                      <div class="num-s">
                        <el-tooltip class="item" effect="dark" content="过期和未来30天" placement="bottom">
                          <div @click="clickDialog(2)" class="cursor">
                            <b class="font-18">{{contractPlanPaFtThTotalSize}}</b>
                            <span class="font-14">笔</span>
                          </div>
                        </el-tooltip>
                      </div>
                    </div>
                    <div class="m-t-20 w-80">
                      <div @click="clickDialog(9)" class="table-detail text-center cursor">
                        <div class="iconb-lef">
                          <i class="el-icon-connection"></i>
                        </div>
                        <p class="text-muted margin-0">本月回款</p>
                      </div>
                      <div class="num-s">
                        <el-tooltip class="item" effect="dark" content="本月" placement="bottom">
                          <div @click="clickDialog(9)" class="cursor">
                            <b class="font-18">{{contractPlanMonthTotalSize}}</b>
                            <span class="font-14">笔</span>
                          </div>
                        </el-tooltip>
                      </div>
                    </div>
                  </el-col>
                  </el-row>
                </el-tab-pane>
                <el-tab-pane v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 3" label="采购">
                  <el-row>
                    <el-col :span="12">
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(10)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-shopping-cart-1"></i>
                          </div>
                          <p class="text-muted margin-0">采购单</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="执行中" placement="bottom">
                            <div @click="clickDialog(10)" class="cursor">
                              <b class="font-18">{{purTotalSize}}</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(7)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-coin"></i>
                          </div>
                          <p class="text-muted margin-0">计划付款</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="过期和未来30天" placement="bottom">
                            <div @click="clickDialog(7)" class="cursor">
                              <b class="font-18">{{paymentPlanPaFtThTotalSize}}</b>
                              <span class="font-14">笔</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(11)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-bank-card"></i>
                          </div>
                          <p class="text-muted margin-0">未尽付款</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="执行中" placement="bottom">
                            <div @click="clickDialog(11)" class="cursor">
                              <b class="font-18">{{purNotPaymentTotalSize}}</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(12)"  class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-circle-check"></i>
                          </div>
                          <p class="text-muted margin-0">完成采购</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="过去30天" placement="bottom">
                            <div @click="clickDialog(12)" class="cursor">
                              <b class="font-18">{{purPastThirtyTotalSize}}</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                      <div class="m-t-20 w-80">
                        <div @click="clickDialog(13)" class="table-detail text-center cursor">
                          <div class="iconb-lef">
                            <i class="el-icon-collection"></i>
                          </div>
                          <p class="text-muted margin-0">付款发票</p>
                        </div>
                        <div class="num-s">
                          <el-tooltip class="item" effect="dark" content="过期和未来30天" placement="bottom">
                            <div @click="clickDialog(13)" class="cursor">
                              <b class="font-18">{{paymentInvoicePaFtThTotalSize}}</b>
                              <span class="font-14">单</span>
                            </div>
                          </el-tooltip>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </el-tab-pane>
                <!--<el-tab-pane label="库管">定时任务补偿</el-tab-pane>
                <el-tab-pane label="维修">定时任务补偿</el-tab-pane>-->
              </el-tabs>
            </el-row>
          </el-row>
        </el-row>
        <!--dialog-->
        <el-dialog title="列表" :visible.sync="dialogVisible " width="50%" style="color: #333333"
                   @open="openDialog" @close="closeDialog"  v-loading="loading">
          <el-divider></el-divider>
          <el-row class="card-box">
            <el-row>
              <span @click="openFullScreen1" class="inform"><i class="el-icon-refresh-right"></i></span>
              <p class="m-b-10 font-b font-12 c-b">{{title}}</p>
            </el-row>
            <el-row v-show="contractPlanPaFtThShow">
              <div class="inbox-d font-12"  v-for="p in contractPlanPaFtThList">
               <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.planreceivableDate}}</span>
                  <router-link :to="{path:'/planreceivableview',query: {backId: p.planreceivableId}}">
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.planreceivableMoney}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">第{{p.planreceivableIssue}}期</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="contractPlanMonthShow">
              <div class="inbox-d font-12"  v-for="p in contractPlanMonthList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.planreceivableDate}}</span>
                  <router-link :to="{path:'/planreceivableview',query: {backId: p.planreceivableId}}">
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.planreceivableMoney}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">第{{p.planreceivableIssue}}期</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="conShow">
              <div class="inbox-d font-12"  v-for="p in contractList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.contractStartTime}}</span>
                  <router-link :to="{path:'/contractview',query: {contractId: p.contractId}}">
                    <span class="color-hui color-hui-h">{{p.contractTheme}}</span>
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.contractTotalAmount}}</span>
                  </router-link>
<!--                  <span class="m-r-5 color-hui">{{p.warehouseByWarehouseId.warehouseName}}</span>-->
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="conNotPaymentShow">
              <div class="inbox-d font-12"  v-for="p in contractNotPaymentList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.contractStartTime}}</span>
                  <router-link :to="{path:'/contractview',query: {contractId: p.contractId}}">
                    <span class="color-hui color-hui-h">{{p.contractTheme}}</span>
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.contractTotalAmount}}</span>
                  </router-link>
                <!--  <span class="m-r-5 color-hui">{{p.warehouseByWarehouseId.warehouseName}}</span>-->
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="paymentPlanPaFtThShow">
              <div class="inbox-d font-12"  v-for="p in paymentPlanPaFtThList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.paymentPlanDate}}</span>
                  <router-link :to="{path:'/plannedpaymentview',query: {payId: p.paymentPlanId}}">
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.paymentPlanAmount}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">第{{p.paymentPlanPeriods}}期</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="paymentPlanMonthShow">
              <div class="inbox-d font-12"  v-for="p in paymentRecordMonthList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.paymentRecordsDate}}</span>
                  <span @click="openPaymentRecord(p)" class="m-r-5 color-hui color-hui-h cursor">￥{{p.paymentRecordsAmount}}</span>
                  <span class="m-r-5 color-hui">第{{p.paymentRecordsPeriods}}期</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="purShow">
              <div class="inbox-d font-12"  v-for="p in purchaseList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.purchaseDate}}</span>
                  <router-link :to="{path:'/purchaseview',query: {purId: p.purchaseId}}">
                    <span class="color-hui color-hui-h">{{p.purchaseTheme}}</span>
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.purchaseAmount}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">{{p.warehouseByWarehouseId.warehouseName}}</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="purPastThirtyShow">
              <div class="inbox-d font-12"  v-for="p in purchasePastThirtyList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.purchaseDate}}</span>
                  <router-link :to="{path:'/purchaseview',query: {purId: p.purchaseId}}">
                    <span class="color-hui color-hui-h">{{p.purchaseTheme}}</span>
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.purchaseAmount}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">{{p.warehouseByWarehouseId.warehouseName}}</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="purNotPaymentShow">
              <div class="inbox-d font-12"  v-for="p in purchaseNotPaymentList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.purchaseDate}}</span>
                  <router-link :to="{path:'/purchaseview',query: {purId: p.purchaseId}}">
                    <span class="color-hui color-hui-h">{{p.purchaseTheme}}</span>
                    <span class="m-r-5 color-hui color-hui-h">￥{{p.purchaseAmount}}</span>
                  </router-link>
                  <span class="m-r-5 color-hui">{{p.warehouseByWarehouseId.warehouseName}}</span>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="paymentInvoicePaFtThShow">
              <div class="inbox-d font-12"  v-for="p in paymentInvoicePaFuThList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{p.paymentInvoiceTicketDate}}</span>
                  <span @click="openPayInvoice(p)" class="m-r-5 color-hui color-hui-h cursor">{{p.paymentInvoiceAbstract}}</span>
                  <span class="m-r-5 color-hui color-hui-h">￥{{p.paymentInvoiceAmount}}</span>
                  <span class="color-black">{{p.purchaseByPurchaseId.purchaseTheme}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/purchaseview',query: {purId: p.purchaseByPurchaseId.purchaseId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                  <span class="color-black">{{p.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: p.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
            <el-row v-show="complainShow">
              <div class="inbox-d font-12"  v-for="c in complainList">
                <div class="m-t-10 m-b-10">
                  <el-icon class="el-icon-star-on"/>
                  <span class="inbox-d-date pull-right">{{c.complainDate | formatDateJudge}}</span>
                  <span class="m-r-5 p-b-10 color-black d-b font-b" >{{types[c.complainType - 1].label}}:</span>
                  <br/>
                  <span class="m-r-5 color-hui color-hui-h cursor" @click="openComplain(c)">{{c.complainTheme}}</span>
                  <span class="color-black">{{c.customerByCustomerId.customerName}}</span>
                  <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
                    <router-link :to="{path:'/customerview',query: {customerId: c.customerByCustomerId.customerId}}">
                      <i style="color: #333333" class="el-icon-s-cooperation"></i>
                    </router-link>
                  </el-tooltip>
                </div>
              </div>
            </el-row>
          </el-row>
        </el-dialog>
      </el-col>
    </el-row>
    <!--速建-->
    <div v-if="this.emp.department.deptId ===1 || this.emp.department.deptId === 2" @click="openBuildBox" id="isBuild" v-show="buildIconShow" class="position-plus font-box cursor po-hover">
      <el-icon id="isBuildIcon" class="el-icon-plus fa-3x m-t-15"/>
      <br/>
      <span id="isBuildText">速建</span>
    </div>
    <div ref="isBuild" v-show="buildBoxShow" class="position-plus new-box">
      <h5 class="text-muted font-14"><i @click="closeBuildBox" class="el-icon-minus text-muted pull-right inform"> </i>速建 </h5>
      <h4 @click="openCus"><a class="cursor"><i class="el-icon-user-solid"/>客户</a></h4>
      <h4>
        <a @click="openAction" class="cursor"><i class="el-icon-suitcase"/><span>行动</span></a>
        <a @click="openTask" class="cursor"><i class="el-icon-bell "/><span>待办任务</span></a>
      </h4>
      <h4>
        <a @click="openQuo" class="cursor"><i class="el-icon-document"/><span>报价</span></a>
        <a @click="openContract" class="cursor" ><i class="el-icon-tickets"/><span>订单合同</span></a>
      </h4>
      <h4>
        <a @click="openBack" class="cursor"><i class="el-icon-coin"/><span>回款</span></a>
        <a @click="openPlanBack"class="cursor"><i class="el-icon-collection-tag"/><span>计划回款</span></a>
      </h4>
    </div>
    <el-dialog title="QA武器库" :visible.sync="dialogQa" width="60%" style="color: #333333"  >
      <el-form :model="qa" ref="qa" label-width="100px" >
        <el-divider><span class="font-14-bold">QA武器库</span></el-divider>
        <el-row>
          <el-col>
            <el-form-item label="问题:" prop="qaQuestion">
              <el-input  v-model="qa.qaQuestion" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="解答:">
              <el-input type="textarea"  v-model="qa.qaAnswer" :autosize="{ minRows: 10, maxRows: 10}" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="作者:">
              <el-input :disabled="true" v-model="qa.employeeByEmpId.empName" style="width: 79%">
                <el-button slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建日期:">
              <el-date-picker  v-model="qa.qaCreateDate" type="date" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="分类:">
              <el-radio-group v-model="qa.qaType">
                <el-radio :label=1>A</el-radio>
                <el-radio :label=2>B</el-radio>
                <el-radio :label=3>C</el-radio>
                <el-radio :label=4>D</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="7">
            <el-form-item>
              <el-button type="primary" @click="addQaList()">保存</el-button>
              <el-button @click="dialogQa = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
    </el-dialog>
    <el-dialog title="投诉管理" :visible.sync="dialogCom"  width="60%" style="color: #333333"  >
      <el-form :model="complain" ref="complain" label-width="100px" :rules="comRules">
        <el-divider><span class="font-14-bold">投诉管理</span></el-divider>
        <el-row>
          <el-col>
            <el-form-item label="对应客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true"  v-model="complain.customerByCustomerId.customerName" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="投诉主题:" prop="complainTheme">
              <el-input v-model="complain.complainTheme" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="接待人:" prop="employeeByEmpId.empName">
              <el-input :disabled="true" v-model="complain.employeeByEmpId.empName" style="width: 79%">
                <el-button @click="openEmpDialog" slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分类:">
              <el-select v-model="complain.complainType" placeholder="未选" style="width: 79%">
                <el-option  v-for="item in types" :key="item.value"
                            :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="描述:">
              <el-input type="textarea"  v-model="complain.complainDescribe" :autosize="{ minRows: 2, maxRows: 2}" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item  label="日期:" prop="complainDate">
              <el-date-picker  v-model="complain.complainDate"  type="date" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item  label="时间:"  prop="complainTime">
              <el-time-picker  v-model="complain.complainTime" style="width: 79%" value-format="HH:mm:ss"></el-time-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item  label="投诉人:">
              <el-select  v-model="complain.complainContactName" placeholder="未选" style="width: 91%">
                <el-option v-for="(item,index) in contactList" :key="index" :label="item.contactName" :value="item.contactName">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="紧急程度:">
              <el-radio-group v-model="complain.complainUrgentLevel">
                <el-radio :label=5>非常紧急</el-radio>
                <el-radio :label=6>急</el-radio>
                <el-radio :label=7>普通</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="处理结果:">
              <el-radio-group v-model="complain.complainHandleResult">
                <el-radio :label=8>未处理</el-radio>
                <el-radio :label=9>处理中</el-radio>
                <el-radio :label=10>处理完成</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item  label="花费时间:">
              <el-select v-model="complain.complainCostTime" placeholder="未选"   style="width: 79%">
                <el-option v-for="item in times" :key="item.value"
                           :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="客户反馈:">
              <el-input  v-model="complain.complainFeedback" type="textarea" :autosize="{ minRows: 2, maxRows: 3}"  style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="回访确认:">
              <el-input  v-model="complain.complainReturnVisit" type="textarea" :autosize="{ minRows: 2, maxRows: 3}" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="备注:">
              <el-input  v-model="complain.complainRemarks" type="textarea" :autosize="{ minRows: 2, maxRows: 3}" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="7">
            <el-form-item>
              <el-button type="primary" @click="addComplain">保存</el-button>
              <el-button @click="dialogCom = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <el-dialog title="付款记录" :visible.sync="dialogPayRec" width="60%" style="color: #333333">
      <el-form :model="paymentRecords" ref="payRecords" label-width="100px" :rules="payRecRules">
        <hr style="margin-bottom: 15px">
        <el-row>
          <el-col>
            <el-form-item label="采购单:">
              <el-input v-model="paymentRecords.purchaseByPurchaseId.purchaseTheme" placeholder="未选" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="期次:">
              <el-select v-model="paymentRecords.paymentRecordsPeriods" placeholder="未选"  style="width: 79%">
                <el-option v-for="item in paymentRecQcOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款日期:" prop="paymentRecordsDate">
              <el-date-picker v-model="paymentRecords.paymentRecordsDate" type="date" placeholder="选择日期" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="金额:" prop="paymentRecordsAmount">
              <el-input v-model.number="paymentRecords.paymentRecordsAmount" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="付款方式:" prop="paymentRecordsPayStyle">
              <el-select v-model="paymentRecords.paymentRecordsPayStyle" placeholder="未选"  style="width: 79%">
                <el-option v-for="item in paymentRecFsOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否收票:">
              <el-radio-group v-model="paymentRecords.paymentRecordsWhetherTicket">
                <el-radio :label="1">未收</el-radio>
                <el-radio :label="2">已收</el-radio>
                <el-radio :label="3">无需发票</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="paymentRecords.customerByCustomerId.customerName" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="对应对货单:" >
              <el-input :disabled="true" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="经手人:" prop="employeeByEmpId.empName">
              <el-input :disabled="true" v-model="paymentRecords.employeeByEmpId.empName" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分类:" >
              <el-select v-model="paymentRecords.paymentRecordsClassify" placeholder="未选"  style="width: 79%">
                <el-option v-for="item in paymentRecFlOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="备注:">
              <el-input v-model="paymentRecords.paymentRecordsNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button @click="addPayRecords" type="primary">保存</el-button>
              <el-button @click="dialogPayRec = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
    </el-dialog>
    <!--待办任务dialog-->
    <el-dialog title="待办任务" :visible.sync="dialogTask" width="60%" style="color: #333333"
               @open="openDialogTask" @close="closeDialogTask">
      <el-form ref="task" :model="task" label-width="100px" :rules="taskRules">
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <el-form-item label="行动描述:" prop="taskDescribe">
              <el-input v-model="task.taskDescribe" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"  style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="执行人:" prop="employeeByExeEmpId.empName">
              <el-input v-model="task.employeeByExeEmpId.empName" style="width: 91%">
                <el-button @click="openEmpDialog" slot="append" icon="el-icon-search" ></el-button>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="完成期限:">
              <el-date-picker v-model="task.taskFinishDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="时间:">
              <el-time-picker v-model="task.taskTime" value-format="hh:mm:ss" style="width:79%" :picker-options="{selectableRange: '00:00:00 - 23:59:59'}"
                              placeholder="任意时间点">
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8" style="line-height: 40px">
            <el-form-item label="优先:">
              <el-radio-group v-model="task.taskPriority">
                <el-radio :label="1">高</el-radio>
                <el-radio :label="2">低</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="task.customerByCustomerId.customerName" style="width: 91%"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer">
              <el-input v-model="customerValue" clearable size="medium" placeholder="拼音.字母.关键字" style="width: 20%"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="cleanCustomer" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="line-height: 40px">
            <el-form-item label="联系人:">
              <el-select v-model="task.taskContactName" placeholder="未选" style="width: 79%">
                <el-option v-for="(item,index) in contactList" :key="index" :label="item.contactName" :value="item.contactName">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态:">
              <el-radio-group v-model="task.taskStatus">
                <el-radio :label="1">未结束</el-radio>
                <el-radio :label="2">已结束</el-radio>
                <el-radio :label="3">取消</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="创建人:" >
              <el-input v-model="task.employeeByEmpId.empName" :disabled="true" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="创建时间:">
              <el-input v-model="task.taskCreateDate" :disabled="true" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button @click="saveTask" type="primary">保存</el-button>
              <el-button @click="dialogTask = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog客户-->
      <el-dialog width="30%" title="客户选择" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
      <!--内层dialog员工-->
      <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body>
        <div>
          <el-collapse v-model="activeName">
            <el-collapse-item @click="findEmp(dept.deptId)" v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
              <ul class="emp-ul">
                <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                  <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                  <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                  <span class="">{{emp.empName}}</span>
                </li>
              </ul>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-dialog>
    </el-dialog>
    <!--行动历史记录dialog-->
    <el-dialog title="行动历史记录" :visible.sync="dialogAction" width="60%" style="color: #333333"
               @open="openDialogAct" @close="closeDialogAct">
      <el-form ref="act" :model="action" label-width="100px" :rules="actRules">
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <el-form-item label="行动描述:" prop="taskDescribe">
              <el-input v-model="action.taskDescribe" type="textarea" :autosize="{ minRows: 2, maxRows: 4}"  style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="action.customerByCustomerId.customerName" style="width: 91%"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer">
              <el-input v-model="customerValue" clearable size="medium" placeholder="拼音.字母.关键字" style="width: 20%"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="cleanCustomer" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="line-height: 40px">
            <el-form-item label="联系人:">
              <el-select v-model="action.taskContactName" placeholder="未选" style="width: 79%">
                <el-option v-for="(item,index) in contactList" :key="index" :label="item.contactName" :value="item.contactName">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" style="line-height: 40px">
            <el-form-item label="维修单:">
              <el-select v-model="action.maintenanceByMaiId" value-key="maiId" placeholder="未选" style="width: 79%">
                <el-option v-for="item in maintenanceList" :key="item.maiId" :label="item.maiNo" :value="item">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="类型:" prop="taskClassify">
              <el-select v-model="action.taskClassify" placeholder="未选" style="width: 270px">
                <el-option v-for="item in actOptions" :key="item.label" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="日期:">
              <el-date-picker v-model="action.taskFinishDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:79%"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="执行人:" prop="employeeByExeEmpId.empName">
              <el-input v-model="action.employeeByExeEmpId.empName" style="width: 91%">
                <el-button @click="openEmpDialog" slot="append" icon="el-icon-search" ></el-button>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="7">
            <el-form-item>
              <el-button @click="saveAction" type="primary">保存</el-button>
              <el-button @click="dialogAct = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog客户-->
      <el-dialog width="30%" title="客户选择" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
      <!--内层dialog员工-->
      <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body
                 @close="closeInnerDialogEmp">
        <div>
          <el-collapse v-model="activeName">
            <el-collapse-item v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
              <ul class="emp-ul">
                <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                  <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                  <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                  <span class="">{{emp.empName}}</span>
                </li>
              </ul>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-dialog>
    </el-dialog>
    <!--报价dialog-->
    <el-dialog title="报价/预下单" :visible.sync="dialogQuo" @open="openDialogQuo" @close="closeDialogQuo" width="60%" style="color: #333333"  >
      <el-form :model="quotation" ref="quo" label-width="100px" :rules="quoRules">
        <el-divider><span class="font-14-bold"></span></el-divider>
        <el-row>
          <el-col :span="12">
            <el-form-item label="主题:" prop="quotationTheme">
              <el-input v-model="quotation.quotationTheme" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="转成订单:">
              <el-radio-group v-model="quotation.quotationStatus">
                <el-radio :label="1">可见</el-radio>
                <el-radio :label="2">不可见</el-radio>
                <el-radio :disabled="true" :label="3">转成订单</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="quotation.customerByCustomerId.customerName" style="width: 91%"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer">
              <el-input v-model="customerValue" clearable size="medium" placeholder="拼音.字母.关键字" style="width: 18%"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="cleanCustomer" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="报价单号:">
              <el-input :disabled="true" v-model="quotation.quotationNo" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分类:">
              <el-select v-model="quotation.quotationClassify" placeholder="未选" style="width: 79%">
                <el-option v-for="(item,index) in quoOptions" :key="index" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="日期:">
              <el-date-picker v-model="quotation.quotationDate" type="date" placeholder="选择日期" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报价:" prop="quotationPrice">
              <el-input v-model.number="quotation.quotationPrice" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="销售机会:" prop="opportunityByOppId">
              <el-select v-model="quotation.opportunityByOppId" value-key="oppId" placeholder="未选" style="width: 91%">
                <el-option v-for="item in opportunityList" :key="item.oppId" :label="item.oppTheme" :value="item">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="明细:" style="width: 92%">
              <el-row v-if="this.quotation.quotationId === 0" class="gz-style">
                <div style="float: right">保存后方可编辑明细</div>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item  label="接受人:" prop="quotationContactName">
              <el-select v-model="quotation.quotationContactName"  placeholder="未选" style="width: 91%">
                <el-option v-for="(item,index) in contactList" :key="index" :label="item.contactName" :value="item.contactName">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="报价人:" prop="employeeByEmpId.empName">
              <el-input :disabled="true" v-model="quotation.employeeByEmpId.empName" style="width: 91%">
                <el-button @click="openEmpDialog" slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="交付说明:">
              <el-input v-model="quotation.quotationDelivery" style="width: 91%" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="付款方式:">
              <el-input v-model="quotation.quotationPayment" style="width: 91%" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="包装运输说明:">
              <el-input v-model="quotation.quotationPackage" style="width: 91%" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="备注:">
              <el-input v-model="quotation.quotationRemarks" style="width: 91%" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="审批状态:" style="width:91%">
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="审批记录:" style="width:91%">
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="7">
            <el-form-item>
              <el-button @click="addQuotation" type="primary">保存</el-button>
              <el-button @click="dialoQuo = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog-->
      <el-dialog width="30%" title="客户选择" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
      <!--内层dialog员工-->
      <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body
                 @close="closeInnerDialogEmp">
        <div>
          <el-collapse v-model="activeName">
            <el-collapse-item v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
              <ul class="emp-ul">
                <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                  <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                  <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                  <span class="">{{emp.empName}}</span>
                </li>
              </ul>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-dialog>
    </el-dialog>
    <!--新增客户dialog简略版-->
    <el-dialog @close="closeDialogEmp('newCustomer')"  :visible.sync="dialogCus" width="60%" style="color: #333333;"  >
      <el-form :model="customer" :rules="cusRules" ref="newCustomer" label-width="100px">
        <el-row style="text-align: center">
          <span style="font-size: 28px;line-height: 28px">新增客户</span>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="24">
            <el-form-item prop="customerName" label="客户:" style="width: 95%">
              <el-input v-model="customer.customerName" placeholder="客户名称"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item prop="customerSimplename" label="简称:" style="width: 90%">
              <el-input v-model="customer.customerSimplename" placeholder="客户简称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="customerFrom" label="来源:" style="width: 90%">
              <el-select v-model="customer.customerFrom" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in userFrom" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item prop="customerPhone" label="手机:" style="width: 90%">
              <el-input v-model="customer.customerPhone" placeholder="手机号码"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="customerTel" label="电话:" style="width: 90%">
              <el-input v-model="customer.customerTel" placeholder="电话号码"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item prop="customerTip" label="备注:" style="width: 95%">
              <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="customer.customerTip" style="width: 100%">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" :offset="8">
            <el-form-item>
              <el-button @click="addNewCustomer('newCustomer')" type="primary">保存</el-button>
              <el-button @click="dialogCus = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <!--合同订单dialog-->
    <el-dialog title="合同订单" :visible.sync="dialogCon" @open="openDialogCon" @close='closeDialogCon' width="60%" style="color: #333333" >
      <el-form :model="contract" ref="con" label-width="100px" :rules="conRules">
        <el-row style="margin-bottom: 15px"></el-row>
        <hr style="margin-bottom: 15px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="主题:" prop="name" style="width: 830px">
              <el-input v-model="contract.contractTheme" placeholder="关于合同的主题"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="对应客户:" style="width: 830px" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="contract.customerByCustomerId.customerName" placeholder="必选"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer" >
              <el-input v-model="customerValue" @input="findCustomer" size="medium" placeholder="拼音.字母.关键字" style="width: 150px"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="closeEmp" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="对应机会:" prop="opportunityByOppId">
              <el-select v-model="contract.opportunityByOppId" value-key="oppId" placeholder="未选" style="width: 730px">
                <el-option v-for="item in opportunityList" :key="item.oppId" :label="item.oppTheme" :value="item">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="合同订单号:" style="width: 395px">
              <el-input :disabled="true" v-model="contract.contractNo" placeholder="保存后自动生成"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同类型:">
              <el-select placeholder="未选"  style="width: 290px" v-model="contract.contractSort">
                <el-option v-for="(item,index) in lxOptions" :key="index" :label="item.label" :value="item.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="总金额:" style="width: 395px">
              <el-input v-model="contract.contractTotalAmount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款方式:">
              <el-select placeholder="未选"  style="width: 290px" v-model="contract.contractPaymentMethods">
                <el-option v-for="item in pays" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="下单时间:">
              <el-date-picker  type="date" placeholder="当前日期" style="width: 296px" v-model="contract.contractStartTime" :disabled="true"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间:" prop="contractEndTime">
              <el-date-picker  type="date" placeholder="选择日期" style="width: 290px" v-model="contract.contractEndTime"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="客户签约人:" style="width: 370px" prop="contractCustomerSigner">
              <el-select v-model="contract.contractCustomerSigner"  placeholder="未选" style="width: 290px">
                <el-option v-for="(item,index) in contactList" :key="index" :label="item.contactName" :value="item.contactName">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <!-- <el-form-item label="我方签约人:" style="width: 370px" prop="contractOurSigner">
               <el-input style="width: 290px" v-model="contract.contractOurSigner">
               </el-input>
             </el-form-item>-->
            <el-form-item label="我方签约人:" style="width: 370px" prop="employeeByEmpId.empName">
              <el-input style="width: 290px" :disabled="changeEmp" v-model="contract.employeeByEmpId.empName" >
                <el-button @click="openEmpDialog" slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所有者:" style="width: 370px">
              <el-input :disabled="true" style="width: 296px" placeholder="boss">
                <el-button slot="append" icon="el-icon-search" ></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结款方式:">
              <el-select v-model="contract.contractMoneyMethods" placeholder="未选"  style="width: 290px">
                <el-option v-for="item in paytimes" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="已回款金额:" style="width: 395px">
              <el-input  :disabled="true" placeholder="￥0.00" v-model="contract.contractBackAmount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="已开票金额:" style="width: 395px">
              <el-input  :disabled="true" placeholder="￥0.00" v-model="contract.contractInvoiceAmount"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="margin-left: 56px;margin-bottom: 20px">
            <span style="margin-right: 10px">状态:</span>
            <el-radio-group v-model="conRadio">
              <el-radio :label="1">未生效</el-radio>
              <el-radio :label="2">执行中</el-radio>
              <el-radio :label="3">结束</el-radio>
              <el-radio :label="4">意外终止</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注:" style="width: 830px">
              <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="contract.contractNote"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="正文及附件:" style="width: 830px">
              <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="contract.contractBodyText"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!--订单明细（产品）-->
        <el-row>
          <el-col>
            <el-form-item label="订单明细:" style="width: 95%">
              <el-row v-if="this.contract.contractId === 0" class="gz-style">
                <div style="float: right">保存后方可编辑明细</div>
              </el-row>
              <el-row v-if="this.contract.contractId !== 0">
                <el-row>
                  <el-col :span="4" :offset="12">
                    <span class="cursor" @click="openPro(contract.contractId)"><i class="el-icon-edit"></i>编辑明细</span>
                  </el-col>
                  <el-col :span="4">
                    <span class="cursor"  @click="printPdf(contract.contractId)"><i class="el-icon-printer"></i>打印单据</span>
                  </el-col>
                  <el-col :span="4">
                    <span class="cursor"><i class="el-icon-notebook-2"></i>导出word打印</span>
                  </el-col>
                </el-row>
                <div class="detail">
                  <el-table style="width: 100%" border show-summary>
                    <el-table-column prop="productByProductId.productName" label="产品名" >
                    </el-table-column>
                    <el-table-column prop="productByProductId.productModel" label="型号" >
                    </el-table-column>
                    <el-table-column prop="productDetailCount" label="数量" >
                    </el-table-column>
                    <el-table-column prop="productDetailOutNum" label="已交付" >
                    </el-table-column>
                    <!-- <el-table-column prop="productDetailOutNum" label="未出库" >
                     </el-table-column>-->
                    <el-table-column label="未交付" >
                      <template slot-scope="scope">
                        {{scope.row.productDetailCount-scope.row.productDetailOutNum}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="productDetailPrice" label="单价" >
                      <template slot-scope="scope">
                        ￥{{scope.row.productDetailPrice}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="productDetailMoney" label="金额" >
                      <template slot-scope="scope">
                        ￥{{ (scope.row.productDetailMoney = scope.row.productDetailPrice *scope.row.productDetailCount)}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="productDetailRemarks" label="备注" >
                    </el-table-column>
                  </el-table>
                </div>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="出库情况:" style="width: 95%">
              <el-row v-if="this.contract.contractId === 0" class="gz-style">
                <div style="float: right">保存后方可编辑明细</div>
              </el-row>
              <el-row v-if="this.contract.contractId !== 0">
                <div class="detail">
                  <el-table style="width: 100%" border show-summary>
                  </el-table>
                </div>
              </el-row>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="审批状态:" style="width:91%">
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="审批记录:" style="width:91%">
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button type="primary" @click="addContract()">保存</el-button>
              <el-button @click="dialogCon = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog-->
      <el-dialog width="30%" title="全部客户" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
      <!--内层dialog员工-->
      <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body @close="closeInnerDialogEmp">
        <div>
          <el-collapse v-model="activeName">
            <el-collapse-item v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
              <ul class="emp-ul">
                <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                  <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                  <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                  <span class="">{{emp.empName}}</span>
                </li>
              </ul>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-dialog>
    </el-dialog>
    <!--回款dialog-->
    <el-dialog title="回款记录" :visible.sync="dialogBack" width="60%"  @open="openDialogBack" @close='closeDialogBack' style="color: #333333"  >
      <el-form :model="collectionrecords" label-width="100px" ref="rec" :rules="backRules" >
        <hr style="margin-bottom: 15px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="对应客户:" style="width: 830px" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="collectionrecords.customerByCustomerId.customerName"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer">
              <el-input v-model="customerValue" clearable @input="findCustomer" size="medium" placeholder="拼音.字母.关键字" style="width: 150px"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="closeEmp" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="合同订单:" prop="contractByContractId">
              <!--key绑定主键，要和select的value-key属性对应，引用字段名要一致，label用于显示内容，value值用来包含对象，用来提交-->
              <el-select v-model="collectionrecords.contractByContractId" value-key="contractId" placeholder="未选" style="width: 730px">
                <el-option v-for="item in contractList" :key="item.contractId" :label="item.contractTheme" :value="item">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="期次:" prop="collectionrecordPeriods">
              <el-select v-model="collectionrecords.collectionrecordPeriods" placeholder="未选"  style="width: 290px">
                <el-option
                  v-for="item in backPeriods"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="回款日期:" prop="collectionrecordDate">
              <el-date-picker  type="date" placeholder="选择日期" style="width: 290px" v-model="collectionrecords.collectionrecordDate"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="回款金额:" style="width: 395px" prop="collectionrecordAmount">
              <el-input v-model="collectionrecords.collectionrecordAmount"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款方式:">
              <el-select placeholder="未选"  style="width: 290px" v-model="collectionrecords.collectionrecordPaystyle">
                <el-option
                  v-for="item in payStyleOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所有者:" style="width: 370px">
              <el-input style="width: 296px" :disabled="true" v-model="collectionrecords.employeeByEmpId.empName">
                <el-button slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="分类:">
              <el-select placeholder="未选"  style="width: 290px" v-model="collectionrecords.collectionrecordSort">
                <el-option
                  v-for="item in sortOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="对应退货单:" style="width: 830px">
              <el-input :disabled="true" v-model="collectionrecords.collectionrecordReturnlist"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="margin-left: 30px;margin-bottom: 20px">
            <span style="margin-right: 10px">已开发票:</span>
            <el-radio-group v-model="backRadio">
              <el-radio :label="1">否</el-radio>
              <el-radio :label="2">是</el-radio>
              <el-radio :label="3">无需开票</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注:" style="width: 830px">
              <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="collectionrecords.collectionrecordNote"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button type="primary" @click="addCollectionRecords">保存</el-button>
              <el-button @click="dialogBack = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog-->
      <el-dialog width="30%" title="全部客户" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
    </el-dialog>
    <!--计划回款-->
    <el-dialog title="计划回款/应收表" :visible.sync="dialogPlanBack" @open="openDialogPlanBack" @close='closeDialogPlanBack'  width="60%" style="color: #333333"  >
      <el-form :model="planreceivable" ref="plan" label-width="100px" :rules="PlanBackRules">
        <hr style="margin-bottom: 15px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="对应客户:" style="width: 830px" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="planreceivable.customerByCustomerId.customerName"></el-input>
            </el-form-item>
            <div class="form-inline" v-show="isCustomer">
              <el-input v-model="customerValue" clearable @input="findCustomer" size="medium" placeholder="拼音.字母.关键字" style="width: 150px"></el-input>
              <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
              <el-popover placement="top" v-model="visible">
                <div style="margin-bottom: 10px">
                  <span>查询条件:{{customerValue}}</span>
                  <span @click="closeEmp" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                </div>
                <ul class="cu-ul" v-if="customerList2 !== ''">
                  <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                </ul>
                <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                  <i class="el-icon-warning-outline"/>没有符合条件的客户！
                </div>
              </el-popover>
              <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
              </el-tooltip>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="合同订单:" prop="contractByContractId">
              <!--key绑定主键，要和select的value-key属性对应，引用字段名要一致，label用于显示内容，value值用来包含对象，用来提交-->
              <el-select v-model="planreceivable.contractByContractId" value-key="contractId" placeholder="未选" style="width: 730px">
                <el-option v-for="item in contractList" :key="item.contractId" :label="item.contractTheme" :value="item">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="计划回款日期:" style="width: 395px">
              <el-date-picker  type="date" placeholder="选择日期" style="width: 296px" v-model="planreceivable.planreceivableDate"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="期次:" prop="planreceivableIssue">
              <el-select v-model="planreceivable.planreceivableIssue" placeholder="未选"  style="width: 290px">
                <el-option
                  v-for="item in PlanBackPeriods"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="金额:" style="width: 395px" prop="planreceivableMoney">
              <el-input v-model="planreceivable.planreceivableMoney"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="负责人:" style="width: 370px" prop="planreceivableEmpName">
              <el-input style="width: 292px" v-model="planreceivable.planreceivableEmpName">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所有者:">
              <el-input :disabled="true" style="width: 730px" v-model="planreceivable.employeeByEmpId.empName">
                <el-button slot="append" icon="el-icon-search" ></el-button>
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" style="margin-left: 30px;margin-bottom: 20px">
            <span style="margin-right: 10px">是否回款:</span>
            <el-radio-group v-model="PlanBackRadio">
              <el-radio :label="1">已回</el-radio>
              <el-radio :label="2">未回</el-radio>
              <el-radio :label="3">不提醒</el-radio>
            </el-radio-group>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注:" style="width: 830px">
              <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="planreceivable.planreceivableNote"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button type="primary" @click="addPlanReceivable()">保存</el-button>
              <el-button @click="dialogPlanBack = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog-->
      <el-dialog width="30%" title="全部客户" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
    </el-dialog>
    <!--采购发票dialog-->
    <el-dialog title="采购发票" :visible.sync="dialogPayInv" width="60%" style="color: #333333">
      <el-form :model="paymentInvoice" ref="payInvoice" label-width="100px" :rules="payInvRules">
        <hr style="margin-bottom: 15px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="摘要:" prop="paymentInvoiceAbstract">
              <el-input v-model="paymentInvoice.paymentInvoiceAbstract "style="width:79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="票据类型:" prop="paymentInvoicePaperType">
              <el-select v-model="paymentInvoice.paymentInvoicePaperType" placeholder="未选"  style="width: 79%">
                <el-option v-for="item in payInvFlOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="金额:" prop="paymentInvoiceAmount">
              <el-input v-model.number="paymentInvoice.paymentInvoiceAmount" style="width: 79%"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收票日期:" prop="paymentInvoiceTicketDate">
              <el-date-picker v-model="paymentInvoice.paymentInvoiceTicketDate" type="date" placeholder="选择日期" style="width: 79%"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="采购单:" prop="purchaseByPurchaseId">
              <el-input v-model="paymentInvoice.purchaseByPurchaseId.purchaseTheme" placeholder="未选" style="width: 91%">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="经手人:" prop="employeeByEmpId.empName">
              <el-input :disabled="true" v-model="paymentInvoice.employeeByEmpId.empName" style="width: 79%">
                <el-button slot="append" icon="el-icon-search"></el-button>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="期次:">
              <el-select v-model="paymentInvoice.paymentInvoicePeriods" placeholder="未选"  style="width: 79%">
                <el-option v-for="item in payInvQcOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="供应商/客户:" prop="customerByCustomerId.customerName">
              <el-input :disabled="true" v-model="paymentInvoice.customerByCustomerId.customerName" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="是否付款:">
              <el-select placeholder="未选" v-model="paymentInvoice.paymentInvoiceWhetherPay" style="width: 79%" >
                <el-option v-for="item in payInvOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否付款计划:" >
              <el-select placeholder="未选"  style="width: 79%" v-model="paymentInvoice.paymentInvoiceWhetherPayPlan">
                <el-option v-for="item in payInvOptions" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="发票号码:">
              <el-input :disabled="true" v-model="paymentInvoice.paymentInvoiceNo" placeholder="自动生成" style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="备注:">
              <el-input v-model="paymentInvoice.paymentInvoiceNote" type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容"  style="width: 91%"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" :offset="6">
            <el-form-item>
              <el-button @click="addPayInvoice" type="primary">保存</el-button>
              <el-button @click="dialogPayInv = false">取消</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!--内层dialog-->
      <el-dialog width="30%" title="客户选择" :visible.sync="innerDialog" append-to-body>
        <!--选择客户-->
        <el-table :data="customerList" style="width: 100%">
          <el-table-column prop="customerId" label="客户编号" >
          </el-table-column>
          <el-table-column prop="customerName" label="客户名" >
          </el-table-column>
          <el-table-column label="请选择" >
            <template slot-scope="scope">
              <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-row style="margin-top:10px">
          <el-col :span="16">
            <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                           :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
          </el-col>
        </el-row>
      </el-dialog>
      <!--内层dialog员工-->
      <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body
                 @close="closeInnerDialogEmp">
        <div>
          <el-collapse v-model="activeName">
            <el-collapse-item v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
              <ul class="emp-ul">
                <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                  <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                  <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                  <span class="">{{emp.empName}}</span>
                </li>
              </ul>
            </el-collapse-item>
          </el-collapse>
        </div>
      </el-dialog>
    </el-dialog>
  </div>
</template>

<script>
  import {formatTimeToStr} from "../assets/format";
  export default {
  data(){
    return{
      emp:{job:{jobName:''},department:{}},
      empMenuList:[],
      PlanBackRadio:2,
      dialogBack:false,
      changeEmp:true, // 是否可以改变负责人
      funMenuList:[],
      menuShow:false,
      approvalList:[],// 待审批集合
      taskList:[],// 待办任务集合
      pageSize: 7, // 分页页大小
      currPage: 1, // 当前页码，默认为1
      totalSize: 0, // 总记录数
      taskPageSize: 5, // 分页页大小
      taskCurrPage: 1, // 当前页码，默认为1
      taskTotalSize: 0, // 总记录数
      expired:1,// 是否过期
      isExShow:false,// 过期盒子显示
      isChShow:false,// 沟通盒子显示
      dialogVisible:false,
      loading:false,// 加载
      title:'',
      content:'',
      PlanBackRules: {
        planreceivableMoney: [
          { required: true, message: '请填写', trigger: 'change' },
        ],
        planreceivableEmpName:[
          { required: true, message: '必须填', trigger: 'blur' }
        ],
        planreceivableIssue: [
          { required: true, message: '必选', trigger: 'change' }
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        'contractByContractId':[
          { required: true, message: '请选择合同', trigger: 'blur' }
        ]
      },
      planreceivable: {
        employeeByEmpId:'',//所有者(负责人)
        planreceivableId:0,
        planreceivableDate:'',//回款日期
        planreceivableNote:'',//备注
        planreceivableBack:'',//是否回款
        planreceivableIssue:'',//期次
        planreceivableMoney:'0.0',//金额
        planreceivableEmpName:'',//所有者
        planreceivablePrincipal:'',//负责人
        customerByCustomerId:'',//客户
        contractByContractId:'',//合同订单
        employeeByAppEmpId:null,
        planreceivableAppStatus:0
      },
      /*下拉框条件查询*/
      ztOptions:[{
        value: 0,
        label: '未回'
      }, {
        value: 1,
        label: '已回'
      }, {
        value: 2,
        label: '不提醒'
      }],
      //弹出框的期次
      PlanBackPeriods: [{
        value: 1,
        label: '1'
      }, {
        value: 2,
        label: '2'
      }, {
        value: 3,
        label: '3'
      }, {
        value: 4,
        label: '4'
      }, {
        value: 5,
        label: '5'
      }, {
        value: 6,
        label: '6'
      }],
      qa: {
        qaId: 0,
        qaQuestion: '',
        qaAnswer: '',
        qaType: '',
        employeeByEmpId: '',
        qaCreateDate: ''
      },
      qaContent:'',
      qaList:[],
      qaShow:false,
      dialogQa:false,
      complain: {
        complainId: 0,
        complainTheme: '',
        complainDescribe: '',
        complainType: '',
        complainUrgentLevel: '',
        complainHandleResult: '',
        complainReturnVisit: '',
        complainFeedback: '',
        complainCostTime: '',
        complainDate: '',
        complainTime: '',
        complainRemarks: '',
        complainContactName: '',
        customerByCustomerId: '',
        employeeByEmpId: ''
      },
      complainList:[],
      complainTotalSize:0,
      complainShow:false,
      dialogCom:false,
      comRules: {
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        complainTheme: [
          { required: true, message: '请输入投诉主题', trigger: 'blur' },
          { min: 2, max: 8, message: '长度在 2 到 8 个字符', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择接待人', trigger: 'blur' }
        ],
        complainDate: [
          { required: true, message: '请选择日期', trigger: 'blur' }
        ],
        complainTime: [
          { required: true, message: '请选择时间', trigger: 'blur' }
        ]
      },
      types: [{
        value: 1,
        label: '产品投诉'
      }, {
        value: 2,
        label: '服务投诉'
      }, {
        value: 3,
        label: '客户意见'
      }, {
        value: 4,
        label: '其他'
      }],
      times: [{
        value: 0,
        label: '1小时'
      }, {
        value: 1,
        label: '2小时'
      }, {
        value: 2,
        label: '半个工作日'
      }, {
        value: 3,
        label: '1个工作日'
      }, {
        value: 4,
        label: '2个工作日'
      }, {
        value: 5,
        label: '2个工作日以上'
      }],
      dialogPlanBack:false,
      remindPageSize: 6, // 分页页大小
      remindCurrPage: 1, // 当前页码，默认为1
      paymentPlanPaFtThList:[],
      paymentPlanPaFtThTotalSize:0,
      paymentPlanPaFtThShow:false,
      paymentRecords:{
        paymentRecordsId:0,
        paymentRecordsPeriods:'',
        paymentRecordsDate:'',
        paymentRecordsAmount:'',
        paymentRecordsPayStyle:'',
        paymentRecordsWhetherTicket:'',
        paymentRecordsClassify:'',
        paymentRecordsNote:'',
        employeeByEmpId:'',
        customerByCustomerId:'',
        purchaseByPurchaseId:'',
        paymentPlanByPaymentPlanId:'',
        returnByReturnId:null
      },
      payRecRules: {
        paymentRecordsAmount: [
          { required: true, message: '必须填'},
          { type: 'number', message: '必须为数字'}
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        purchaseByPurchaseId: [
          { required: true, message: '必须填', trigger: 'blur' }
        ],
        paymentRecordsDate: [
          { required: true, message: '必须填', trigger: 'blur' }
        ],
        paymentRecordsPayStyle: [
          { required: true, message: '必须填', trigger: 'blur' }
        ]
      },
      paymentRecQcOptions: [{
        value: 1,
        label: '1'
      }, {
        value: 2,
        label: '2'
      }, {
        value: 3,
        label: '3'
      }, {
        value: 4,
        label: '4'
      }, {
        value: 5,
        label: '5'
      }, {
        value: 6,
        label: '6'
      },{
        value: 7,
        label: '7'
      }, {
        value: 8,
        label: '8'
      }, {
        value: 9,
        label: '9'
      }, {
        value: 10,
        label: '10'
      }, {
        value: 11,
        label: '11'
      }, {
        value: 12,
        label: '12'
      }],
      paymentRecFsOptions: [{
        value: 1,
        label: '支票'
      }, {
        value: 2,
        label: '现金'
      }, {
        value: 3,
        label: '邮政付款'
      },{
        value: 4,
        label: '电汇'
      }, {
        value: 5,
        label: '网上银行'
      },{
        value: 6,
        label: '其他'
      }],
      paymentRecFlOptions: [{
        value: 1,
        label: '购货款'
      }, {
        value: 2,
        label: '转账'
      }, {
        value: 3,
        label: '抵债付款'
      }],
      dialogPayRec:false,
      paymentRecordMonthList:[],
      paymentRecordMonthTotalSize:0,
      paymentPlanMonthShow:false,
      contractPlanPaFtThList:[],
      contractPlanPaFtThTotalSize:0,
      contractPlanPaFtThShow:false,
      contractPlanMonthList:[],
      contractPlanMonthTotalSize:0,
      contractPlanMonthShow:false,
      contractList:[],
      conTotalSize:0,
      conShow:false,
      conNotPaymentShow:false,
      contractNotPaymentList:[],
      conNotPaymentTotalSize:0,
      purchaseList:[],
      purTotalSize:0,
      purShow:false,
      purchaseNotPaymentList:[],
      purNotPaymentTotalSize:0,
      purNotPaymentShow:false,
      purchasePastThirtyList:[],
      purPastThirtyTotalSize:0,
      purPastThirtyShow:false,
      paymentInvoicePaFuThList:[],
      paymentInvoicePaFtThTotalSize:0,
      paymentInvoicePaFtThShow:false,
      buildIconShow:true,//速建图标
      buildBoxShow:false,//速建盒子
      contains:'',
      cusPageSize: 5, // 分页页大小
      cusCurrPage: 1, // 当前页码，默认为1
      cusTotalSize: 0, // 总记录数
      isCustomer: true, // 客户搜索显示
      innerDialog: false,// 内层dialog客户
      innerDialogEmp: false,// 内层dialog员工
      activeName: [],
      deptList:[],
      customerList: [], // 员工客户集合
      contactList: [], // 客户联系人集合
      maintenanceList: [],//维修工单集合
      customerValue:'',// 模糊查询客户
      customerList2:[],// 模糊查询结果
      visible: false,// 模糊搜索结果
      dialogTask:false,
      dialogAction:false,
      dialogQuo:false,
      dialogCon:false,
      task: {
        taskId:0,
        taskDescribe:'',
        taskContactName:'',
        taskFinishDate:'',
        taskTime:null,
        taskPriority:'',
        taskStatus:'',
        taskCreateDate:'',
        taskIs:'',
        opportunityByOppId:null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByExeEmpId:{},
      },
      /*弹出框的分类*/
      lxOptions: [{
        value: 1,
        label: '产品销售'
      }, {
        value: 2,
        label: '服务'
      }, {
        value: 3,
        label: '业务合作'
      }, {
        value: 4,
        label: '代理分销'
      }, {
        value: 5,
        label: '其他'
      }],
      pays: [{
        value: 1,
        label: '微信'
      }, {
        value: 2,
        label: '支付宝'
      }, {
        value: 3,
        label: '现金'
      }, {
        value: 4,
        label: '网上银行'
      }, {
        value: 5,
        label: '其他'
      }],
      /*弹出框的付款方式*/
      paytimes: [{
        value: 1,
        label: '现款现结'
      }, {
        value: 2,
        label: '货到付款'
      }, {
        value: 3,
        label: '先款后货'
      }, {
        value: 4,
        label: '账期收款'
      }, {
        value: 5,
        label: '月结'
      },{
        value: 6,
        label: '季结'
      },{
        value: 7,
        label: '年结'
      }],
      conRadio: 1,
      collectionrecords: {
        collectionrecordId: 0,
        collectionrecordPeriods: '',
        collectionrecordDate: '',
        collectionrecordAmount: '0.0',
        collectionrecordPaystyle: '',
        collectionrecordSort: '',
        collectionrecordInvoiced: 0,
        collectionrecordNote: '',
        collectionrecordCustomerName: '',
        collectionrecordEmpName: '',
        collectionrecordReturnlist: '',
        contractByContractId: '',//合同
        employeeByEmpId: '',//员工
        customerByCustomerId: ''//客户
      },
      backRadio:1,
      backRules: {
        collectionrecordAmount: [
          { required: true, message: '请填写', trigger: 'change' },
        ],
        collectionrecordPeriods:[
          { required: true, message: '必选', trigger: 'blur' }
        ],
        collectionrecordDate: [
          { required: true, message: '必选',trigger: 'blur'}
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'contractByContractId':[
          { required: true, message: '请选择合同', trigger: 'blur' }
        ]
      },
      //是否开票
      ztOptions: [{
        value: 1,
        label: '未开发票'
      }, {
        value: 2,
        label: '已开发票'
      }, {
        value: 3,
        label: '无需开票'
      }],
      //弹出框的期次
      backPeriods: [{
        value: 1,
        label: '1'
      }, {
        value: 2,
        label: '2'
      }, {
        value: 3,
        label: '3'
      }, {
        value: 4,
        label: '4'
      }, {
        value: '选项5',
        label: '5'
      }, {
        value: 6,
        label: '6'
      }],
      //支付方式
      payStyleOptions: [{
        value: 1,
        label: '微信'
      }, {
        value: 2,
        label: '支付宝'
      }, {
        value: 3,
        label: '现金'
      }, {
        value: 4,
        label: '网上银行'
      }, {
        value: 5,
        label: '其他'
      }],
      //分类
      sortOptions: [{
        value: 1,
        label: '新客户付款'
      }, {
        value: 2,
        label: '老客户付款'
      }, {
        value: 3,
        label: '押金'
      }, {
        value: 4,
        label: '贷款'
      }, {
        value: 5,
        label: '服务费'
      }],
      // 表单验证
      conRules: {
        opportunityByOppId : [
          { required: true, message: '请选择机会', trigger: 'change' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: ' ', trigger: 'blur' }
        ],
        contractCustomerSigner: [
          { required: true, message: '请选择客户签约人', trigger: 'change' }
        ],
        contractEndTime: [
          { type: 'date', required: true, message: '请选择日期', trigger: 'change'  }
        ]
      },
      taskRules: {
        taskDescribe: [
          {required: true, message: '必须填', trigger: 'blur'}
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByExeEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ]
      },
      action:{
        taskId:0,
        taskDescribe:'',
        taskExecutor:'',
        taskContactName:'',
        taskFinishDate:'',
        taskClassify:'',
        taskIs:'',
        opportunityByOppId:null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByExeEmpId:{},
        maintenanceByMaiId:null
      },
      actRules: {
        taskDescribe: [
          {required: true, message: '必须填', trigger: 'blur'}
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByExeEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        taskClassify: [
          { required: true, message: '必须填', trigger: 'change' }
        ]
      },
      actOptions: [{
        value: 1,
        label: '电话'
      }, {
        value: 2,
        label: '上门'
      }, {
        value: 3,
        label: '来访接待'
      }, {
        value: 4,
        label: '会议'
      },{
        value: 5,
        label: '培训'
      }, {
        value: 6,
        label: '商务餐旅'
      }, {
        value: 7,
        label: '外出活动'
      },{
        value: 8,
        label: '其他'
      }, {
        value: 9,
        label: '微信记录'
      }, {
        value: 10,
        label: 'QQ记录'
      }, {
        value: 11,
        label: '电话随记'
      }],
      quotation: {
        quotationId: 0,
        quotationTheme: '',
        quotationNo: '',
        quotationStatus: '',
        quotationClassify: '',
        quotationDate: '',
        quotationPrice: '',
        quotationDelivery: '',
        quotationPayment: '',
        quotationPackage: '',
        quotationRemarks: '',
        quotationContactName: '',
        quotationAppStatus: 0,
        opportunityByOppId: null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByAppEmpId:null
      },
      contract: {
        contractId: 0,//合同id
        contractTheme: '', //主题
        opportunityByOppId:'',//销售机会
        customerByCustomerId: '',//对应客户
        employeeByEmpId:'',//所有者
        contractChance:'',//对应机会
        contractNo:'',  //合同订单号
        contractSort:'',//分类
        contractTotalAmount:0,  //总金额
        contractPaymentMethods:'', //付款方式
        contractStartTime:'',  //下单时间
        contractEndTime:'', //结束时间
        contractCustomerSigner:'',//客户签约人
        contractOurSigner:'', //我方签约人
        // contractEmpName:'',  //所有者
        contractBackAmount:0,//已回款金额
        contractInvoiceAmount:0,//已开票金额
        contractMoneyMethods:'',  //结款方式
        contractStatus: '', //状态
        contractBodyText:'',  //合同正文及附件
        contractNote:'',//备注
        contractAppStatus: 0,
        employeeByAppEmpId:null
      },
      opportunityList: [],// 销售机会集合
      quoDetailList:[],
      quoRules: {
        quotationTheme: [{
          required: true,
          message: '必须填',
          trigger: 'blur'
        }],
        opportunityByOppId : [
          { required: true, message: '请选择机会', trigger: 'change' }
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        quotationPrice: [
          { required: true, message: '必须填'},
          { type: 'number', message: '必须为数字'}
        ]
      },
      quoOptions: [{
        value: 1,
        label: '证券报价'
      }, {
        value: 2,
        label: '投标报价'
      }, {
        value: 3,
        label: '产品报价'
      }],
      dialogCus:false,
      customer: {
        customerId: 0,//客户ID
        customerSimplename: '',//客户简称
        customerName: '',//客户名称
        customerLifecycle: '',//生命周期
        customerType: '',//客户种类（类型）
        customerContractdate: '',//客户首次签约日期
        customerCreatDate: '',//客户创建日期
        customerPhone: '',//客户手机
        customerTel: '',//客户电话
        customerTip: '',//客户备注
        customerFrom: '',//客户来源
        custoemrCompanyname: '',//公司名称
        customerCompanytip: '',//公司备注
        customerPeoplenumber: '',//公司人数规模
        customerWork: '',//从事行业
        customerHttp: '',//公司网址
        customerAddress: '',//详细地址
        contractsByCustomerId:null,
        employeeByEmpId:null,
      },
      //客户表单验证
      cusRules :{
        customerName: [
          { required: true,message: '请输入客户名称', trigger: 'blur' },
          { min: 2, max: 16, message: '长度在 2 到 16 个字符', trigger: 'blur' }
        ],
        customerSimplename: [
          { required: true,message: '请输入客户简称', trigger: 'blur' },
          { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }
        ],
        customerFrom: [
          { required: true, message: '请选择客户来源', trigger: 'blur' }
        ],
        customerPhone: [
          { required: true ,message: '请输入客户联系方式', trigger: 'blur' },
          { min: 8, max: 15, message: '长度在 8 到 15 个字符', trigger: 'blur' }
        ],
        customerType: [
          { required: true, message: '请选择客户类型', trigger: 'blur' }
        ],
        customerAddress: [
          { required: true,message: '请输入客户地址', trigger: 'blur' },
          { min: 6, max: 32, message: '长度在 6 到 32 个字符', trigger: 'blur' }
        ]
      },
      userFrom: [{
        value: 1,
        label: '电话来访'
      }, {
        value: 2,
        label: '客户介绍'
      }, {
        value: 3,
        label: '独立开发'
      }, {
        value: 4,
        label: '媒体宣传'
      }, {
        value: 5,
        label: '老客户'
      }],
      dialogPayInv:false,
      paymentInvoice:{
        paymentInvoiceId:0,
        paymentInvoiceAbstract:'',
        paymentInvoicePaperType:'',
        paymentInvoiceTicketDate:'',
        paymentInvoiceAmount:'',
        paymentInvoicePeriods:'',
        paymentInvoiceWhetherPay:'',
        paymentInvoiceWhetherPayPlan:'',
        paymentInvoiceNo:'',
        paymentInvoiceNote:'',
        customerByCustomerId:{},
        purchaseByPurchaseId:'',
        employeeByEmpId:{}
      },
      payInvRules: {
        paymentInvoiceAbstract: [
          { required: true, message: '必须填', trigger: 'blur'},
        ],
        paymentInvoicePaperType: [
          { required: true, message: '必须填', trigger: 'blur'},
        ],
        paymentInvoiceAmount: [
          { required: true, message: '必须填'},
          { type: 'number', message: '必须为数字'}
        ],
        paymentInvoiceTicketDate: [
          { required: true, message: '必须填', trigger: 'blur' }
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        purchaseByPurchaseId: [
          { required: true, message: '必须填', trigger: 'blur' }
        ],
      },
      payInvQcOptions: [{
        value: 1,
        label: '1'
      }, {
        value: 2,
        label: '2'
      }, {
        value: 3,
        label: '3'
      }, {
        value: 4,
        label: '4'
      }, {
        value: 5,
        label: '5'
      }, {
        value: 6,
        label: '6'
      },{
        value: 7,
        label: '7'
      }, {
        value: 8,
        label: '8'
      }, {
        value: 9,
        label: '9'
      }, {
        value: 10,
        label: '10'
      }, {
        value: 11,
        label: '11'
      }, {
        value: 12,
        label: '12'
      }],
      payInvFlOptions: [{
        value: 1,
        label: '增值'
      }, {
        value: 2,
        label: '普通国税'
      }, {
        value: 3,
        label: '普通地税'
      },{
        value: 4,
        label: '收据'
      }],
      payInvOptions: [{
        value: 1,
        label: '未付'
      }, {
        value: 2,
        label: '已付'
      }],
      payInvPayPlanOptions: [{
        value: 1,
        label: '未建'
      }, {
        value: 2,
        label: '已建'
      }, {
        value: 3,
        label: '已付款无须计划'
      }],
    }
  },
  methods:{
    //新增、修改回款计划
    addPlanReceivable(){
      // 状态
      this.planreceivable.planreceivableBack = this.PlanBackRadio
      this.$refs.plan.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-planreceivable',
            {
              planreceivableId:this.planreceivable.planreceivableId,
              planreceivableDate:this.planreceivable.planreceivableDate,
              planreceivableNote:this.planreceivable.planreceivableNote,
              planreceivableBack:this.planreceivable.planreceivableBack,
              planreceivableIssue:this.planreceivable.planreceivableIssue,
              planreceivableMoney:this.planreceivable.planreceivableMoney,
              contractByContractId:this.planreceivable.contractByContractId,
              customerByCustomerId:this.planreceivable.customerByCustomerId,
              employeeByEmpId:this.planreceivable.employeeByEmpId,
            })
            .then(v => {
              this.dialogPlanBack = false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {})
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 打开dialog事件
    openDialogPlanBack() {
      if(this.planreceivable.planreceivableId === 0) {
        this.planreceivable.employeeByEmpId = this.emp
        this.planreceivable.planreceivableDate = this.addDate()
        this.planreceivable.planreceivableBack = 1
      }
    },
    // 关闭dialog事件
    closeDialogPlanBack() {
      // this.$refs.plan.resetFields()
      this.planreceivable = {
        planreceivableId:0,
        planreceivableDate:'',//回款日期
        planreceivableNote:'',//备注
        planreceivableBack:'',//是否回款
        planreceivableIssue:0,//期次
        planreceivableMoney:'0.0',//金额
        planreceivableEmpName:'',//所有者
        planreceivablePrincipal:'',//负责人
        customerByCustomerId:{},//客户
        contractByContractId:'',//合同订单
        employeeByEmpId: ''
      }
      this.isCustomer = true
      this.contactList = []
      this.contractList = []
    },
    // 点击打开回款计划dialog
    openPlanBack(){
      this.dialogPlanBack= true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    //新增、修改回款
    addCollectionRecords(){
      //开票状态
      this.collectionrecords.collectionrecordInvoiced = this.BackRadio
      this.$refs.rec.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-collectionrecord',
            {
              collectionrecordId:this.collectionrecords.collectionrecordId,
              collectionrecordPeriods:this.collectionrecords.collectionrecordPeriods,
              collectionrecordDate:this.collectionrecords.collectionrecordDate,
              collectionrecordAmount:this.collectionrecords.collectionrecordAmount,
              collectionrecordPaystyle:this.collectionrecords.collectionrecordPaystyle,
              collectionrecordSort:this.collectionrecords.collectionrecordSort,
              collectionrecordInvoiced:this.collectionrecords.collectionrecordInvoiced,
              collectionrecordNote:this.collectionrecords.collectionrecordNote,
              //collectionrecordCustomerName:this.collectionrecords.collectionrecordCustomerName,
              //collectionrecordEmpName:this.collectionrecords.collectionrecordEmpName,
              collectionrecordReturnlist:this.collectionrecords.collectionrecordReturnlist,
              contractByContractId:this.collectionrecords.contractByContractId,
              customerByCustomerId:this.collectionrecords.customerByCustomerId,
              employeeByEmpId:this.collectionrecords.employeeByEmpId,
            })
            .then(v => {
              this.dialogBack = false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {})
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 打开回款dialog事件
    openDialogBack () {
      // this.collectionrecords.employeeByEmpId = this.emp
      if(this.collectionrecords.collectionrecordId === 0){
        this.collectionrecords.employeeByEmpId = this.emp
        this.collectionrecords.collectionrecordDate = this.addDate()
        this.collectionrecords.collectionrecordInvoiced = 1
      }
    },
    // 关闭回款dialog事件
    closeDialogBack () {
      // this.$refs.rec.resetFields()
      this.collectionrecords = {
        collectionrecordId:0,
        collectionrecordPeriods:0,
        collectionrecordDate:'',
        collectionrecordAmount:0.00,
        collectionrecordPaystyle:0,
        collectionrecordSort:0,
        collectionrecordInvoiced:0,
        collectionrecordNote:'',
        collectionrecordCustomerName:'',
        collectionrecordEmpName:'',
        collectionrecordReturnlist:'',
        customerByCustomerId:{},//客户
        contractByContractId:'',//合同订单
        employeeByEmpId: ''
      }
      this.isCustomer = true
      this.contactList = []
      this.contractList = []
    },
    // 点击打开回款dialog
    openBack(){
      this.dialogBack = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 失去焦点关闭模糊搜索框
    closeEmp(){
      this.visible = false
      this.customerValue = ''
    },
    // 合同订单号
    contractNo() {
      var contractNo = "HTCY";
      for (var i = 0; i < 5; i++) //j位随机数，用以加在时间戳后面。
      {
        contractNo += Math.floor(Math.random() * 10);
      }
      contractNo = contractNo+this.addDate();
      return contractNo;
    },
    // 新增、修改
    addContract() {
      // 状态
      this.contract.contractStatus = this.radio
      this.contract.contractStartTime = this.addDate()
      if(this.contract.contractId == 0){
        this.contract.contractNo = this.contractNo()
      }
      this.$refs.con.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-contract',
            {
              contractId:this.contract.contractId,
              contractTheme:this.contract.contractTheme,
              contractChance:this.contract.contractChance,
              contractNo:this.contract.contractNo,
              contractSort:this.contract.contractSort,
              contractTotalAmount:this.contract.contractTotalAmount,
              contractPaymentMethods:this.contract.contractPaymentMethods,
              contractStartTime:this.contract.contractStartTime,
              contractEndTime:this.contract.contractEndTime,
              contractCustomerSigner:this.contract.contractCustomerSigner,
              contractOurSigner:this.contract.contractOurSigner,
              contractEmpName:this.contract.contractEmpName,
              contractBackAmount:this.contract.contractBackAmount,
              contractMoneyMethods:this.contract.contractMoneyMethods,
              contractStatus:this.contract.contractStatus,
              contractBodyText:this.contract.contractBodyText,
              contractNote:this.contract.contractNote,
              contractByContractId:this.contract.contractByContractId,
              contractAppStatus: this.contract.contractAppStatus,
              employeeByAppEmpId: this.contract.employeeByAppEmpId,
              customerByCustomerId:this.contract.customerByCustomerId,
              opportunity: this.contract.opportunityByOppId,
              employeeByEmpId:this.contract.employeeByEmpId,
              details:this.detailList
            })
            .then(v => {
              this.dialogCon = false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {
            })
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 打开dialog事件
    openDialogCon () {
      // this.contract.employeeByEmpId = this.emp
      if(this.contract.contractId === 0){
        this.contract.employeeByEmpId = this.emp
        this.contract.contractStartTime = this.addDate()
        this.contract.contractStatus = 1
      }
    },
    // 关闭dialog事件
    closeDialogCon () {
      this.$refs.con.resetFields()
      this.contract = {
        contractId:0,
        contractTheme: '', //主题
        customerByCustomerId: '',//对应客户
        contractChance:'',//对应机会
        contractNo:'',  //合同订单号
        contractSort:'',//分类
        contractTotalAmount:0,  //总金额
        contractPaymentMethods:'', //付款方式
        contractStartTime:'',  //下单时间
        contractEndTime:'', //结束时间
        contractCustomerSigner:'',//客户签约人
        contractOurSigner:'', //我方签约人
        contractEmpName:'',  //所有者
        contractBackAmount:0,//回款金额
        contractMoneyMethods:'',  //结款方式
        contractStatus: '', //状态
        contractBodyText:'',  //合同正文及附件
        contractNote:'',//备注
        employeeByEmpId: '',
        opportunityByOppId: '',
        customerByCustomerId: '',
        contractAppStatus: 0,
        employeeByAppEmpId:null
      }
      this.isCustomer = true
      this.approvalRecordList = []
      this.detailList = []
      this.contactList = []
      this.opportunityList = []
    },
    // 查询过去未来30天的回款计划
    findContractPlanPastFutureThirty() {
      this.$axios.get('http://localhost:8088/contract-plan-past-future-thirty-list')
        .then(v => {
          this.contractPlanPaFtThList = v.data
          this.contractPlanPaFtThTotalSize = this.contractPlanPaFtThList.length
        })
        .catch(function (v) {
        })
    },
    // 查询本月的回款计划
    findContractPlanMonth() {
      this.$axios.get('http://localhost:8088/contract-plan-month-list')
        .then(v => {
          this.contractPlanMonthList = v.data
          this.contractPlanMonthTotalSize = this.contractPlanMonthList.length
        })
        .catch(function (v) {
        })
    },
    // 查询未完成的合同订单
    findContractList() {
      this.$axios.get('http://localhost:8088/con-implement-list')
        .then(v => {
          this.contractList = v.data
          this.conTotalSize = this.contractList.length
        })
        .catch(function (v) {
        })
    },
    // 查询未尽回款的合同订单
    findContractNotPaymentList() {
      this.$axios.get('http://localhost:8088/con-not-payment-list')
        .then(v => {
          this.contractNotPaymentList = v.data
          this.conNotPaymentTotalSize = this.contractNotPaymentList.length
        })
        .catch(function (v) {
        })
    },
    // 查询当前员工
    loginEmp(){
      this.$axios.get('http://localhost:8088/emp')
        .then(v => {
          this.emp = v.data
          if (this.emp.department.deptId === 1){
            this.findApproval(this.currPage,this.pageSize)
          }
        })
        .catch(function (v) {})
    },
    // 查询当前员工拥有权限
    loginEmpMenu () {
      this.$axios.get('http://localhost:8088/fun-menu')
        .then(v => {
          this.empMenuList = v.data
        }).catch()
    },
    findMenu () {
      if (this.content !== ''){
        this.$axios.get('http://localhost:8088/funtype-funs-vague',{
          params:{
            content:this.content
          }
        })
          .then(v => {
            this.funMenuList = v.data
            this.menuShow = true
          }).catch()

      }
    },
    goMenu(val){
      let is = true
      this.empMenuList.forEach(fun => {
        for(let i = 0;i < fun.functions.length; i++){
          console.log(fun.functions[i].functionName)
          if (val.functionName === fun.functions[i].functionName){
            this.$router.push(val.functionPath);
            is = false
            break;
          }
        }
      })
      if (is){
        this.$message.error('你没有该功能权限，不能前往');
      }
    },
    // 点击空白关闭模糊查询功能
    menuHide(e){
      if(!this.$refs.isBuild.contains(e.target) && e.target.id !== 'menu-ul' && e.target.id !=='menu-li'&& e.target.id !=='menu-a'){
        this.menuShow = false
      }
    },
    // 查询待审批
    findApproval(currPage,pageSize){
      this.$axios.get('http://localhost:8088/app-status-one-list',{
        params:{
          page:currPage,
          size:pageSize
        }
      })
      .then(v => {
        this.approvalList = v.data.rows
        this.totalSize = v.data.total
      })
      .catch(function (v) {})
    },
    changePage(val){
      this.findApproval(val,this.pageSize)
    },
    // 点击进入审批视图
    toAppView(val) {
      this.$router.push({path: 'approvalview', query: {appId:val.approvalId}});
    },
    // 查询待办任务-未结束-未过期
    findTask(currPage,pageSize){
      this.$axios.get('http://localhost:8088/emp-task-status-list',{
        params:{
          page:currPage,
          size:pageSize,
          taskStatus:1,
          expired:this.expired
        }
      })
        .then(v => {
          this.taskList = v.data.rows
          this.taskTotalSize = v.data.total
        })
        .catch(function (v) {})
    },
    changePageTask(val){
      this.findTask(val,this.taskPageSize)
    },
    // 点击进入待办任务视图
    toTaskView(val) {
      this.$router.push({path: 'taskview', query: {taskId:val.taskId}});
    },
    // 点击查询过期待办任务
    findExpiredTask(){
      this.expired = 2
      this.findTask(this.taskCurrPage,this.taskPageSize)
      this.isExShow = true
      this.isChShow = false
    },
    // 关闭过期提示 查询待办任务
    closeExShow(){
      this.expired = 1
      this.findTask(this.taskCurrPage,this.taskPageSize)
      this.isExShow = false
    },
    // 点击最近沟通未结束未过期的待办任务
    findChatTask(){
      this.$axios.get('http://localhost:8088/emp-task-chat-list',{
        params:{
          page:this.taskCurrPage,
          size:this.taskPageSize,
        }
      })
        .then(v => {
          this.taskList = v.data.rows
          this.taskTotalSize = v.data.total
        })
        .catch(function (v) {})
      this.isChShow = true
      this.isExShow = false
    },
    // 关闭最近沟通 查询待办任务
    closeChShow(){
      this.expired = 1
      this.findTask(this.taskCurrPage,this.taskPageSize)
      this.isChShow = false
    },
    //查询QA
    findQa(qaContent){
      this.$axios.get('http://localhost:8088/qa-all-list', {
        params: {
          search: qaContent
        }
      })
        .then(v => {
          this.qaList = v.data
          this.qaShow = true
        })
        .catch(function (v) {
        })
    },
    openQa (val) {
      this.dialogQa= true
      this.qa.qaId = val.qaId
      this.qa.qaQuestion = val.qaQuestion
      this.qa.qaAnswer = val.qaAnswer
      this.qa.qaType = val.qaType
      this.qa.qaCreateDate = val.qaCreateDate
      this.qa.employeeByEmpId = val.employeeByEmpId
    },
    addQaList () {
      this.$axios.post('http://localhost:8088/qa-addQa/', this.qa)
        .then(v => {
          this.$message({
            type: 'success',
            message: '已保存!'
          })
          this.dialogQa = false
        })
        .catch(function (v) {})
    },
    // 点击打开列表dialog
    clickDialog(val){
      this.dialogVisible = true
      if (val == 1){
        this.title = '合同交付'
        this.conShow = true
      }else if(val == 2){
        this.title = '计划回款（过期和未来30天）'
        this.contractPlanPaFtThShow = true
      }else if(val == 3){
        this.title = '未处理/处理中投诉'
        this.complainShow = true
      }else if(val == 4){
        this.title = '出库未发货（过期和未来30天）'
      }else if(val == 5){
        this.title = '未尽回款（不含中止和结束）'
        this.conNotPaymentShow = true
      }else if(val == 6){
        this.title = '联系人生日（本月和下月）'
      }else if(val == 7){
        this.title = '计划付款（过期和未来30天）'
        this.paymentPlanPaFtThShow = true
      }else if(val == 8){
        this.title = '本月付款'
        this.paymentPlanMonthShow = true
      }else if(val == 9){
        this.title = '本月回款'
        this.contractPlanMonthShow = true
      }else if(val == 10){
        this.title = '采购单（执行中）'
        this.purShow = true
      }else if(val == 11){
        this.title = '未尽付款'
        this.purNotPaymentShow = true
      }else if(val == 12){
        this.title = '完成采购（过去30天）'
        this.purPastThirtyShow = true
      }else if(val == 13){
        this.title = '付款发票（过期和未来30天）'
        this.paymentInvoicePaFtThShow = true
      }
    },
    // 打开列表dialog
    openDialog(){},
    // 关闭列表dialog
    closeDialog(){
      this.title = ''
      this.remindCurrPage = 1
      this.paymentPlanPaFtThShow = false
      this.paymentPlanMonthShow = false
      this.purShow = false
      this.conShow = false
      this.contractPlanPaFtThShow = false
      this.contractPlanMonthShow = false
      this.conNotPaymentShow = false
      this.purPastThirtyShow = false
      this.purNotPaymentShow = false
      this.paymentInvoicePaFtThShow = false
      this.complainShow = false
    },
    // 点击空白关闭模糊查询功能
    qaHide(e){
      if(!this.$refs.isBuild.contains(e.target) && e.target.id !== 'qa-ul' && e.target.id !=='qa-li'&& e.target.id !=='qa-a'){
        this.qaShow = false
      }
    },
    //查询客户投诉
    findComplain () {
      this.$axios.get('http://localhost:8088/complain-type-list')
        .then(v => {
          this.complainList = v.data
          this.complainTotalSize = this.complainList.length
        })
        .catch(function (v) {})
    },
    openComplain (val) {
      this.dialogVisible = false
      this.dialogCom = true
      this.complain.complainId = val.complainId
      this.complain.complainTheme = val.complainTheme
      this.complain.complainDescribe = val.complainDescribe
      this.complain.complainType = val.complainType
      this.complain.complainUrgentLevel = val.complainUrgentLevel
      this.complain.complainHandleResult = val.complainHandleResult
      this.complain.complainReturnVisit = val.complainReturnVisit
      this.complain.complainFeedback = val.complainFeedback
      this.complain.complainCostTime = val.complainCostTime
      this.complain.complainDate = val.complainDate
      this.complain.complainTime = val.complainTime
      this.complain.complainRemarks = val.complainRemarks
      this.complain.complainContactName = val.complainContactName
      this.complain.customerByCustomerId = val.customerByCustomerId
      this.complain.employeeByEmpId = val.employeeByEmpId
      this.choiceContact(val.customerByCustomerId.customerId) // 根据客户名查询联系人集合
    },
    addComplain () {
      this.$axios.post('http://localhost:8088/complain-addComplain', this.complain)
        .then(v => {
          // 1、刷新数据
          this.findComplain()
          this.$message({
            type: 'success',
            message: '已保存!'
          })
          // 2、关闭弹框
          this.dialogCom = false
        })
        .catch(function (v) {})
    },
    // 查询过去未来30天的付款计划
    findPaymentPlanPastFutureThirty() {
      this.$axios.get('http://localhost:8088/pay-plan-past-future-thirty-list')
        .then(v => {
          this.paymentPlanPaFtThList = v.data
          this.paymentPlanPaFtThTotalSize = this.paymentPlanPaFtThList.length
        })
        .catch(function (v) {
        })
    },
    // 查询本月的付款记录
    findPaymentRecordMonth() {
      this.$axios.get('http://localhost:8088/pay-records-month-list')
        .then(v => {
          this.paymentRecordMonthList = v.data
          this.paymentRecordMonthTotalSize = this.paymentRecordMonthList.length
        })
        .catch(function (v) {
        })
    },
    openPaymentRecord(val) {
      this.dialogPayRec = true
      this.dialogVisible = false
      this.paymentRecords.paymentRecordsId = val.paymentRecordsId
      this.paymentRecords.paymentRecordsPeriods = val.paymentRecordsPeriods
      this.paymentRecords.paymentRecordsDate = val.paymentRecordsDate
      this.paymentRecords.paymentRecordsAmount = val.paymentRecordsAmount
      this.paymentRecords.paymentRecordsPayStyle = val.paymentRecordsPayStyle
      this.paymentRecords.paymentRecordsWhetherTicket = val.paymentRecordsWhetherTicket
      this.paymentRecords.paymentRecordsClassify = val.paymentRecordsClassify
      this.paymentRecords.paymentRecordsNote = val.paymentRecordsNote
      this.paymentRecords.customerByCustomerId = val.customerByCustomerId
      this.paymentRecords.employeeByEmpId = val.employeeByEmpId
      this.paymentRecords.purchaseByPurchaseId = val.purchaseByPurchaseId
      this.paymentRecords.paymentPlanByPaymentPlanId = val.paymentPlanByPaymentPlanId
      this.paymentRecords.returnByReturnId = val.returnByReturnId
      this.findPurchaseList(val.customerByCustomerId.customerId)
    },
    addPayRecords() {
      this.$axios.post('http://localhost:8088/save-pay-records',this.paymentRecords)
        .then(v => {
          this.findPaymentRecordMonth()
          this.dialogPayRec = false
          this.$message({
            message: '已保存',
            type: 'success'
          });
        })
        .catch(function (v) {
        })
    },
    // 查询未完成的采购单
    findPurchaseList() {
      this.$axios.get('http://localhost:8088/pur-implement-list')
        .then(v => {
          this.purchaseList = v.data
          this.purTotalSize = this.purchaseList.length

        })
        .catch(function (v) {
        })
    },
    // 查询未尽付款的采购
    findPurchaseNotPaymentList() {
      this.$axios.get('http://localhost:8088/pur-not-payment-list')
        .then(v => {
          this.purchaseNotPaymentList = v.data
          this.purNotPaymentTotalSize = this.purchaseNotPaymentList.length
        })
        .catch(function (v) {
        })
    },
    // 查询过去30天的采购单
    findPurchasePastThirtyList() {
      this.$axios.get('http://localhost:8088/pur-past-thirty-list')
        .then(v => {
          this.purchasePastThirtyList = v.data
          this.purPastThirtyTotalSize = this.purchasePastThirtyList.length
        })
        .catch(function (v) {
        })
    },
    // 查询过去和未来30天的付款票据
    findPaymentInvoicePastFutureThirtyList() {
      this.$axios.get('http://localhost:8088/pay-invoice-past-future-thirty-list')
        .then(v => {
          this.paymentInvoicePaFuThList = v.data
          this.paymentInvoicePaFtThTotalSize = this.paymentInvoicePaFuThList.length
        })
        .catch(function (v) {
        })
    },
    //点击刷新列表
    openFullScreen1(){
      this.loading = true
      this.findPaymentPlanPastFutureThirty()
      this.findPaymentRecordMonth()
      this.findPurchaseList()
      this.findPurchaseNotPaymentList()
      this.findPurchasePastThirtyList()
      this.findPaymentInvoicePastFutureThirtyList()
      this.findPaymentPlanPastFutureThirty()
      this.findPaymentRecordMonth()
      this.findContractPlanPastFutureThirty()
      this.findContractPlanMonth()
      this.findContractList()
      this.findContractNotPaymentList()
      setTimeout(() => {
        this.loading = false;
      }, 1000);
    },
    // 打开速建盒子
    openBuildBox(){
      this.buildIconShow = false
      this.buildBoxShow = true
    },
    // 关闭速建盒子
    closeBuildBox(){
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 点击空白关闭速建盒子
    buildHide(e){
      if(!this.$refs.isBuild.contains(e.target) && e.target.id !== 'isBuild' && e.target.id !='isBuildIcon'&& e.target.id !='isBuildText'){
        this.buildIconShow = true
        this.buildBoxShow = false
      }
    },
    // 打开内层dialog查询客户
    innerVisible (cusCurrPage,cusPageSize) {
      this.$axios.get('http://localhost:8088/emp-customer-list', {
        params: {
          page: cusCurrPage,
          size: cusPageSize,
        }
      })
        .then(v => {
          this.customerList = v.data.rows
          this.cusTotalSize = v.data.total
        })
        .catch(function (v) {})
      this.innerDialog = true
    },
    // 查询客户分页
    cusChangePage (val) {
      // val就是当前页码
      this.innerVisible(val, this.cusPageSize)
    },
    // 选择客户
    choiceCustomer(val){
      if (this.dialogAction === true){
        this.action.customerByCustomerId = val
        this.action.maintenanceByMaiId = null
        this.action.taskContactName = ''
        this.findMaintenanceList(val.customerId)
      }else if (this.dialogTask === true) {
        this.task.customerByCustomerId = val
        this.task.taskContactName = ''
      }else if (this.dialogQuo === true) {
        this.quotation.customerByCustomerId = val
        this.quotation.opportunityByOppId = ''
        this.quotation.quotationContactName = ''
        this.opportunityData(val.customerId)
      }else if (this.dialogCon === true) {
        this.contract.customerByCustomerId = val
        this.contract.opportunityByOppId = ''
        this.opportunityData(val.customerId)
      }else if (this.dialogPlanBack === true) {
        this.planreceivable.customerByCustomerId = val
      }else if (this.dialogBack === true) {
        this.collectionrecords.customerByCustomerId = val
      }
      this.choiceContact(val.customerId)
      this.innerDialog = false;
    },
    // 模糊查询客户
    findCustomer(){
      if (this.customerValue != ''){
        this.visible = true
        this.$axios.get('http://localhost:8088/emp-fuzzy-customer-list', {
          params: {
            customerName: this.customerValue
          }
        })
          .then(v => {
            this.customerList2 = v.data
          })
          .catch(function (v) {})
      }else {
        this.visible = false
      }
    },
    // 模糊选择客户
    choiceCustomer2(val){
      if (this.dialogAction === true){
        this.action.customerByCustomerId = val
        this.action.maintenanceByMaiId = null
        this.action.taskContactName = ''
        this.findMaintenanceList(val.customerId)
      }else if (this.dialogTask === true) {
        this.task.customerByCustomerId = val
        this.task.taskContactName = ''
      }else if (this.dialogQuo === true) {
        this.quotation.customerByCustomerId = val
        this.quotation.opportunityByOppId = ''
        this.quotation.quotationContactName = ''
        this.opportunityData(val.customerId)
      }else if (this.dialogCon === true) {
        this.contract.customerByCustomerId = val
        this.contract.opportunityByOppId = ''
        this.opportunityData(val.customerId)
      }else if (this.dialogBack === true) {
        this.collectionrecords.customerByCustomerId = val
      }else if (this.dialogPlanBack === true) {
        this.planreceivable.customerByCustomerId = val
      }

      this.choiceContact(val.customerId)
      this.customerValue = ''
      this.visible = false
    },
    // 失去焦点关闭模糊搜索框
    cleanCustomer(){
      this.visible = false
      this.customerValue = ''
    },
    // 查询联系人
    choiceContact(customerId) {
      this.$axios.get('http://localhost:8088/contact-list', {
        params: {
          customerId: customerId
        }
      })
        .then(v => {
          this.contactList = v.data
        })
        .catch(function (v) {
        })
    },
    //查询部门员工
    findDeptList () {
      this.$axios.get('http://localhost:8088/dept-emp-list')
        .then(v => {
          this.deptList = v.data
          for(let i = 1;i <= this.deptList.length;i++){
            this.activeName.push(i)
          }
        })
        .catch(function (v) {})
    },
    //打开员工dialog
    openEmpDialog(){
      this.innerDialogEmp = true
      this.findDeptList()
    },
    // 选择员工
    choiceEmp(val) {
      if (this.dialogAction === true){
        this.action.employeeByExeEmpId = val
      }else if (this.dialogTask === true) {
        this.task.employeeByExeEmpId = val
      }else if (this.dialogQuo === true) {
        this.quotation.employeeByEmpId = val
      }else if (this.dialogCon === true) {
        this.contract.employeeByEmpId = val
      }else if (this.dialogBack === true) {
        this.collectionrecords.employeeByEmpId = val
      }else if (this.dialogPlanBack === true) {
        this.planreceivable.employeeByEmpId = val
      }
      this.innerDialogEmp = false;
    },
    //关闭员工diglog事件
    closeInnerDialogEmp(){
      this.activeName = []
    },
    // 点击打开待办任务dialog
    openTask(){
      this.dialogTask = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 打开待办任务dialog事件
    openDialogTask () {
      if (this.task.taskId === 0){
        this.task.employeeByExeEmpId = this.emp
        this.task.taskFinishDate = this.addDate()
        this.task.taskStatus = 1
        this.task.taskPriority = 1
      }
    },
    // 关闭待办任务dialog事件
    closeDialogTask () {
      this.$refs.task.resetFields()
      this.task = {
        taskId:0,
        taskDescribe:'',
        taskContactName:'',
        taskFinishDate:'',
        taskTime:null,
        taskPriority:'',
        taskStatus:'',
        taskCreateDate:'',
        taskIs:'',
        opportunityByOppId:null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByExeEmpId:{}
      }
      this.isCustomer = true
      this.contactList = []
    },
    // 新增、修改待办任务
    saveTask () {
      this.task.taskIs = 1
      if (this.task.taskId === 0){
        this.task.taskCreateDate = this.addDate()
        this.task.employeeByEmpId = this.emp
      }
      this.$refs.task.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-task',
            {
              taskId:this.task.taskId,
              taskDescribe:this.task.taskDescribe,
              taskContactName:this.task.taskContactName,
              taskFinishDate:this.task.taskFinishDate,
              taskTime:this.task.taskTime,
              taskPriority:this.task.taskPriority,
              taskStatus:this.task.taskStatus,
              taskCreateDate:this.task.taskCreateDate,
              taskIs:this.task.taskIs,
              customerByCustomerId:this.task.customerByCustomerId,
              employeeByEmpId:this.task.employeeByEmpId,
              employeeByExeEmpId:this.task.employeeByExeEmpId,
              opportunityByOppId:this.task.opportunityByOppId,
              chatRecordsByQuotationId:[{
                chatRecordId: 0,
                chatRecordContent: '新建待办任务',
                chatRecordDate:null,
                employeeByEmpId:this.emp,
                taskByTaskId:null
              }]
            })
            .then(v => {
              this.findTask(this.taskCurrPage,this.taskPageSize)
              // 2、关闭弹框
              this.dialogTask = false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {})
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 查询维修工单
    findMaintenanceList(cusId){
      this.$axios.get('http://localhost:8088/maintenance-cus-list',{
        params:{
          cusId:cusId
        }
      })
        .then(v => {
          this.maintenanceList = v.data
        })
        .catch(function (v) {})
    },
    // 点击打开记录dialog
    openAction(){
      this.dialogAction = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 打开记录dialog事件
    openDialogAct () {
      if (this.action.taskId === 0){
        this.action.employeeByExeEmpId = this.emp
        this.action.taskFinishDate = this.addDate()
      }
    },
    // 关闭记录dialog事件
    closeDialogAct () {
      this.$refs.act.resetFields()
      this.action = {
        taskId:0,
        taskDescribe:'',
        taskContactName:'',
        taskFinishDate:'',
        taskClassify:'',
        taskIs:'',
        opportunityByOppId:null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByExeEmpId:{},
        maintenanceByMaiId:null
      }
      this.isCustomer = true
      this.contactList = []
      this.maintenanceList = []
    },
    // 查询客户所有机会
    opportunityData(cusId) {
      this.$axios.get('http://localhost:8088/cus-opp-list-all', {
        params: {
          cusId: cusId
        }
      })
        .then(v => {
          this.opportunityList = v.data
        })
        .catch(function (v) {
        })
    },
    // 点击打开报价dialog
    openQuo(){
      this.dialogQuo = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 点击打开合同订单dialog
    openContract(){
      this.dialogCon = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 新增、修改记录
    saveAction () {
      // 状态
      this.action.taskIs = 2
      if (this.action.taskId === 0){
        this.action.employeeByEmpId = this.emp
      }
      this.$refs.act.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-action',
            {
              taskId:this.action.taskId,
              taskDescribe:this.action.taskDescribe,
              taskExecutor:this.action.taskExecutor,
              taskContactName:this.action.taskContactName,
              taskFinishDate:this.action.taskFinishDate,
              taskClassify:this.action.taskClassify,
              taskIs:this.action.taskIs,
              customerByCustomerId:this.action.customerByCustomerId,
              employeeByEmpId:this.action.employeeByEmpId,
              employeeByExeEmpId:this.action.employeeByExeEmpId,
              opportunityByOppId:this.action.opportunityByOppId,
              maintenanceByMaiId:this.action.maintenanceByMaiId
            })
            .then(v => {
              // 2、关闭弹框
              this.dialogAction = false
              this.$router.push('task');
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {})
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 关闭记录dialog事件
    closeDialogAct () {
      this.$refs.act.resetFields()
      this.action = {
        taskId:0,
        taskDescribe:'',
        taskContactName:'',
        taskFinishDate:'',
        taskClassify:'',
        taskIs:'',
        opportunityByOppId:null,
        customerByCustomerId:{},
        employeeByEmpId:'',
        employeeByExeEmpId:{},
        maintenanceByMaiId:null
      }
      this.isCustomer = true
      this.contactList = []
      this.maintenanceList = []
    },
    // 查询客户所有机会
    opportunityData(cusId) {
      this.$axios.get('http://localhost:8088/cus-opp-list-all', {
        params: {
          cusId: cusId
        }
      })
        .then(v => {
          this.opportunityList = v.data
        })
        .catch(function (v) {
        })
    },
    // 点击打开报价dialog
    openQuo(){
      this.dialogQuo = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 打开报价dialog事件
    openDialogQuo() {
      if(this.quotation.quotationId === 0){
        this.quotation.employeeByEmpId = this.emp
        this.quotation.quotationDate = this.addDate()
        this.quotation.quotationStatus = 1
      }
    },
    // 关闭报价dialog事件
    closeDialogQuo() {
      this.$refs.quo.resetFields()
      this.quotation = {
        quotationId: 0,
        quotationTheme: '',
        quotationNo: '',
        quotationStatus: '',
        quotationClassify: '',
        quotationDate: '',
        quotationPrice: '',
        quotationDelivery: '',
        quotationPayment: '',
        quotationPackage: '',
        quotationRemarks: '',
        quotationContactName: '',
        quotationAppStatus: 0,
        opportunityByOppId: null,
        customerByCustomerId: {},
        employeeByEmpId:'',
        employeeByAppEmpId:null
      }
      this.isCustomer = true
      this.contactList = []
      this.opportunityList = []
    },
    // 新增报价
    addQuotation() {
      if(this.quotation.quotationId === 0){
        this.quotation.quotationNo = this.quoNo()
      }
      this.$refs.quo.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-quotation',
            {
              quotationId: this.quotation.quotationId,
              quotationTheme: this.quotation.quotationTheme,
              quotationNo: this.quotation.quotationNo,
              quotationStatus: this.quotation.quotationStatus,
              quotationClassify: this.quotation.quotationClassify,
              quotationDate: this.quotation.quotationDate,
              quotationPrice: this.quotation.quotationPrice,
              quotationDelivery: this.quotation.quotationDelivery,
              quotationPayment: this.quotation.quotationPayment,
              quotationPackage: this.quotation.quotationPackage,
              quotationRemarks: this.quotation.quotationRemarks,
              quotationContactName: this.quotation.quotationContactName,
              employeeByEmpId: this.quotation.employeeByEmpId,
              quotationAppStatus: this.quotation.quotationAppStatus,
              employeeByAppEmpId: this.quotation.employeeByAppEmpId,
              opportunity: this.quotation.opportunityByOppId,
              customerByCustomerId: this.quotation.customerByCustomerId,
              details: this.quoDetailList
            })
            .then(v => {
              this.dialogQuo = false
              this.$router.push({path:'/quotationview',query: {quoId: v.data}});
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {
            })
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 报价单号
    quoNo() {
      var quoNo = "";
      for (var i = 0; i < 4; i++) //j位随机数，用以加在时间戳后面。
      {
        quoNo += Math.floor(Math.random() * 10);
      }
      quoNo = 'BJ' + this.addDateNum() + quoNo;
      return quoNo;
    },
    // 获取当前日期20200206
    addDateNum () {
      var date = new Date();
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var strDate = date.getDate();
      if (month >= 1 && month <= 9) {
        month = "0" + month;
      }
      if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
      }
      var currentdate = year  + month  + strDate;
      return currentdate;
    },
    // 点击打开客户dialog
    openCus(){
      this.dialogCus = true
      this.buildIconShow = true
      this.buildBoxShow = false
    },
    // 关闭客户dialog事件
    closeDialogEmp (formName) {
      this.$refs[formName].resetFields();
      this.customer = {
        customerId: 0,//客户ID
        customerSimplename: '',//客户简称
        customerName: '',//客户名称
        customerLifecycle: '',//生命周期
        customerType: '',//客户种类（类型）
        customerContractdate: '',//客户首次签约日期
        customerCreatdate: '',//客户创建日期
        customerPhone: '',//客户手机
        customerTel: '',//客户电话
        customerTip: '',//客户备注
        customerFrom: '',//客户来源
        custoemrCompanyname: '',//公司名称
        customerCompanytip: '',//公司备注
        customerPeoplenumber: '',//公司人数规模
        customerWork: '',//从事行业
        customerHttp: '',//公司网址
        customerAddress: '',//详细地址
        contractsByCustomerId:null,
        employeeByEmpId: null,
      }
    },
    addNewCustomer(formName){
      this.customer.customerCreatdate = this.addDate()
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/new-customer',this.customer)
            .then(v => {
              // 2、关闭弹框
              this.dialogCus = false
              // 3、重新初始化表单数据模型
            })
            .catch(function (v) {})
          this.$message({
            type: 'success',
            message: '已保存!'
          });
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 获取当前日期
    addDate () {
      var date = new Date();
      var seperator1 = "-";
      var seperator2 = ":";
      var month = date.getMonth() + 1<10? "0"+(date.getMonth() + 1):date.getMonth() + 1;
      var strDate = date.getDate()<10? "0" + date.getDate():date.getDate();
      var currentdate = date.getFullYear() + seperator1  + month  + seperator1  + strDate
      return currentdate
    },
    // 修改数据回显
    openPayInvoice(val) {
      this.dialogVisible = false
      this.dialogPayInv = true
      this.paymentInvoice.paymentInvoiceId = val.paymentInvoiceId
      this.paymentInvoice.paymentInvoiceAbstract = val.paymentInvoiceAbstract
      this.paymentInvoice.paymentInvoicePaperType = val.paymentInvoicePaperType
      this.paymentInvoice.paymentInvoiceTicketDate = val.paymentInvoiceTicketDate
      this.paymentInvoice.paymentInvoiceAmount = val.paymentInvoiceAmount
      this.paymentInvoice.paymentInvoicePeriods = val.paymentInvoicePeriods
      this.paymentInvoice.paymentInvoiceWhetherPay = val.paymentInvoiceWhetherPay
      this.paymentInvoice.paymentInvoiceWhetherPayPlan = val.paymentInvoiceWhetherPayPlan
      this.paymentInvoice.paymentInvoiceNo = val.paymentInvoiceNo
      this.paymentInvoice.paymentInvoiceNote = val.paymentInvoiceNote
      this.paymentInvoice.customerByCustomerId = val.customerByCustomerId
      this.paymentInvoice.employeeByEmpId = val.employeeByEmpId
      this.paymentInvoice.purchaseByPurchaseId = val.purchaseByPurchaseId
      this.isCustomer = false
    },
    // 新增、修改
    addPayInvoice() {
      if (this.paymentInvoice.paymentInvoiceId === 0){
        this.paymentInvoice.paymentInvoiceNo = this.payNo()
      }
      this.$refs.payInvoice.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-pay-invoice',this.paymentInvoice)
            .then(v => {
              this.findPaymentInvoicePastFutureThirtyList()
              this.dialogPayInv= false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {
            })
        } else {
          console.log('error submit!!');
          return false;
        }
      })

    },
  },
  created() {
    this.loginEmp()
    this.loginEmpMenu()
    this.findTask(this.taskCurrPage,this.taskPageSize)
    this.findComplain()
    this.findPaymentPlanPastFutureThirty()
    this.findPaymentRecordMonth()
    this.findPurchaseList()
    this.findPurchaseNotPaymentList()
    this.findPurchasePastThirtyList()
    this.findPaymentInvoicePastFutureThirtyList()
    this.findContractPlanPastFutureThirty()
    this.findContractPlanMonth()
    this.findContractNotPaymentList()
    this.findContractList()
    this.findPurchaseList()
  },
    mounted() {
      document.addEventListener('click',this.buildHide)
      document.addEventListener('click',this.menuHide)
      document.addEventListener('click',this.qaHide)
    },
    beforeDestroy () {
      document.removeEventListener('click',this.buildHide)
      document.removeEventListener('click',this.menuHide)
      document.removeEventListener('click',this.qaHide)
    },
    filters: {
      formatDate: function(time) {
        if(time!=null&&time!="")
        {
          var date = new Date(time);
          return formatTimeToStr(date, "MM-dd hh:mm");
        }else{
          return "";
        }
      },
      formatDate2: function(time) {
        if(time!=null&&time!="")
        {
          var date = new Date(time);
          return formatTimeToStr(date, "MM-dd");
        }else{
          return "";
        }
      },
      formatDateJudge: function(time) {
        if(time != null && time != "") {
          let date = new Date(time);
          let currentDate = new Date()
          let seperator1 = "-";
          let month = currentDate.getMonth() + 1<10? "0"+(currentDate.getMonth() + 1):currentDate.getMonth() + 1;
          let strDate = currentDate.getDate()<10? "0" + currentDate.getDate():currentDate.getDate();
          let today = currentDate.getFullYear() + seperator1  + month  + seperator1  + strDate
          let todayTime = new Date(today)
          let yesterday = todayTime.setDate(todayTime.getDate() - 1)
          let beforeYesterday = todayTime.setDate(todayTime.getDate() - 1)
          let tomorrow = todayTime.setDate(todayTime.getDate() + 3)
          let afterTomorrow = todayTime.setDate(todayTime.getDate() + 1)
          todayTime.setDate(todayTime.getDate() - 2)
          if (date.getTime() === todayTime.getTime()){
            return '今天'
          }else if (date.getTime() ===  yesterday){
            return '昨天'
          }else if (date.getTime() ===  beforeYesterday){
            return '前天'
          }else if (date.getTime() ===  tomorrow){
            return '明天'
          }else if (date.getTime() ===  afterTomorrow){
            return '后天'
          }else {
            return time
          }
        }else{
          return "";
        }
      }
    }
}
</script>

<style>
  .page-title {
      font-size: 20px;
      font-weight: 600;
    }
  .page-user {
    font-size: 16px;
    color: #98a6ad;
  }
  .text-right {
    text-align: right;
    float: right;
  }
  .table-detail {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    text-align: center !important;
  }
  .table-detail:hover .font-14-b {
    color: #23527c;
    margin: 0;
  }
  .btn {
    display: inline-block;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
  }
  .table-detail .iconbox {
    display: inline-block;
    height: 50px;
    width: 50px;
    border-radius: 50%;
    color: #ffffff;
    text-align: center;
    margin: 0px 30px;
    background-color: #5d9cec !important;
  }
  .work .iconbox i {
    line-height: 50px;
    font-size: 20px;
  }
  .font-14-b{
    color: #000000;
    margin: 0;
  }
  .inbox-item{
    border-bottom: 1px solid #f1f1f1;
    padding: 7px 0;
    cursor: pointer
  }
  .iconboxs{
    display: inline-block;
    height: 40px;
    width: 40px;
    border-radius: 50%;
    border: 1px solid #a0a0a0;
    color: #a0a0a0;
    text-align: center;
    margin:0 10px 0 0 ;
  }
  .iconboxs-i{
    width: 40px;
    height: 40px;
    font-size: 20px;
    padding-top: 7px;
  }
  .iconboxs-i-s{
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  .iconboxs-i-s img{
    border-radius: 40px;
  }
  .iconboxs-i-m{
    display: inline-block;
    width: 20px;
    height: 20px;
  }
  .iconboxs-i-m img{
    border-radius: 40px;
  }
  .inbox-item-author {
    height: 25px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 75px;
  }
  .inbox-item-text {
    color: #a0a0a0;
    display: block;
    font-size: 12px;
    margin: 0;
    max-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 25px;
  }
  .b-g-w{
    background: #ffffff;
  }
  .p-20{
    padding: 20px;
  }
  .pull-right{
    float: right
  }
  .pad-mar-5{
    padding: 0 5px;
    margin: 0 5px;
  }
  .pad-mar-5:hover{
    padding: 0 5px;
    margin: 0 5px;
    color: #23527c;
  }
  .cursor{
    cursor: pointer;
  }
  .text-center{
    text-align: center;
  }
  .label-danger{
    background-color: #f05050;
    color: #f3f3f3;
    padding: .3em .6em .3em;
    border-radius: .25em;
    font-weight: 600;
    cursor: pointer;
  }
  .el-tabs__item{
    padding: 0 15px;
  }
  .el-tabs__item.is-top:nth-child(2) {
     padding-left: 15px;
  }
  .font-14{
    font-size: 14px;
  }
  .iconb-lef {
    display: inline-block;
    height: 50px;
    width: 50px;
    border-radius: 50%;
    color: #ffffff;
    text-align: center;
    margin: 0px 30px;
    background-color: rgba(93, 156, 236, 0.2);
    border: 1px solid #5d9cec;
  }
  .iconb-lef i {
    line-height: 50px;
    font-size: 20px;
    color: #5d9cec;
  }
  .text-muted {
    color: #98a6ad;
  }
  .num-s{
    float: right;
    padding-top:20px;
    color: #505458;
  }
  .margin-0{
    margin: 0;
  }
  .m-t-20{
    margin-top: 20px;
  }
  .m-l-20{
    margin-left: 20px;
  }
  .w-80{
    width: 80%;
  }
  .font-18{
    font-size: 18px;
  }
  .font-12{
    font-size: 12px;
  }
  .m-b-10{
    margin:0 0 10px 0;
  }
  .font-b{
    font-weight: bold;
  }
  .color-black{
    color: black;
  }
  .color-hui{
    color:#505458;
  }
  .color-hui-h:hover{
    color: #23527c;
  }
  .inform {
    font-size: 20px;
    cursor: pointer;
    padding-left: 10px;
    float: right;
  }

  .m-r-5{
    margin-right: 5px;
  }
  .m-t-10{
    margin-top: 10px;
  }
  .m-t-15 {
    margin-top: 15px;
  }
  .inbox-d {
    border-bottom: 1px solid #f1f1f1;
    padding: 9px 0;
    position: relative;
    min-height: 40px;
  }
  .inbox-d-date {
    color: #a9a9a9;
    font-size: 11px;
  }
  .cursor{
    cursor: pointer;
  }
  .c-b{
    color: black;
  }
  .position-plus{
    position: fixed;
    right: 20px;
    bottom: 60px;
  }
  .font-box{
    height: 80px;
    width: 80px;
    background-color: #4c5667;
    margin: 0 10px;
    border-radius: 50%;
    color: #ffffff;
    text-align: center;
    z-index: 1001;
  }
  .fa-3x {
    font-size: 3em;
  }
  .po-hover:hover{
    color: #000000;
  }
  .new-box {
    width: auto;
    height: auto;
    border-radius: 5px;
    background: rgba(76, 86, 103,0.9);
    z-index: 1001;
    padding: 10px 20px 0px;
  }
  h5,h4{
    margin:0 0 10px 0;
  }
  .text-muted {
    color: #98a6ad;
  }
  .new-box h4{
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 0px 10px 8px;
    line-height: 1.7;
    font-size: 15px;

  }
  .new-box h4 a{
    display: inline-block;
    width: 120px;
    color: #FFFFFF;
    font-weight: normal;
  }
  .new-box h4 a:hover{
   color:#94c4fb;
  }
  .new-box h4 i {
    padding: 0px 5px;
    font-size: 16px;
  }
  .new-box h4:last-child {
    border-bottom: none;
  }
  .ng-scope-show{
    font-size: 45px;
    line-height: 300px;
    margin: 0px;
    text-align: center;
    color: #f4f8fb;
    font-weight: normal;
  }
</style>
